package org.jeecg.modules.zrzyqc.gzvhb.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.aspect.annotation.PermissionData;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.config.GuavaRateLimiter.RateLimiter;
import org.jeecg.modules.zrzyqc.gzvhb.entity.QcSsgqzysytdqkGzv;
import org.jeecg.modules.zrzyqc.gzvhb.model.ResultCount;
import org.jeecg.modules.zrzyqc.gzvhb.service.IQcSsgqzysytdqkGzvService;
import org.jeecg.modules.zrzyqc.qcsb.entity.QcSsgqzysytdqk1;
import org.jeecg.modules.zrzyqc.qcsb.entity.QcSsgqzysytdqkzc;
import org.jeecg.modules.zrzyqc.qcsb.entity.SsDkjz;
import org.jeecg.modules.zrzyqc.qcsb.service.IQcSsgqzysytdqk1Service;
import org.jeecg.modules.zrzyqc.qcsb.service.IQcSsgqzysytdqkzcService;
import org.jeecg.modules.zrzyqc.qcsb.service.SsDkzjService;
import org.jeecg.modules.zrzyqc.qcsb.vo.QcSsgqzysytdqkGzvVo;
import org.jeecg.modules.zrzyqc.qcsb.vo.QcSsgqzysytdqkVo;
import org.jeecg.modules.zrzyqc.qyxx.entity.QcQyxx;
import org.jeecg.modules.zrzyqc.qyxx.service.IQcQyxxService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.jeecg.modules.zrzyqc.qcsb.constants.Enum.ENTERPRISE_CODE_SQ;
import static org.jeecg.modules.zrzyqc.qcsb.constants.Enum.ENTERPRISE_CODE_SZ;

/**
 * @Description: qc_ssgqzysytdqk_gzv
 * @Author: jeecg-boot
 * @Date:   2024-07-27
 * @Version: V1.0
 */
@Api(tags="qc_ssgqzysytdqk_gzv")
@RestController
@RequestMapping("/qcsb/qcSsgqzysytdqk")
@Slf4j
public class QcSsgqzysytdqkGzvController extends JeecgController<QcSsgqzysytdqkGzv, IQcSsgqzysytdqkGzvService> {
	@Autowired
	private IQcSsgqzysytdqkGzvService qcSsgqzysytdqkGzvService;
	@Autowired
	private IQcSsgqzysytdqkzcService qcSsgqzysytdqkzcService;
	@Value("${jeecg.path.upload}")
	private String upLoadPath;
	@Autowired
	private IQcSsgqzysytdqk1Service qcSsgqzysytdqkService1;
	@Autowired
	private IQcQyxxService qcQyxxService;
	@Autowired
	private ISysBaseAPI sysBaseAPI;
	@Autowired
	private SsDkzjService ssDkzjService;

	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	/**
	 * @AutoLog(value = "省属国企占有使用土地情况调查-分页列表查询")
	 */
	@ApiOperation(value = "省属国企占有使用土地情况调查-分页列表查询", notes = "省属国企占有使用土地情况调查-分页列表查询")
	@GetMapping(value = "/list")
	@PermissionData(pageComponent = "qcsb/QcSsgqzysytdqkList")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
													   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
													   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
													   HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		List<Integer> sbzts = new ArrayList<>();
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		System.out.println(sysUser);
		if ("gzw".equals(sysUser.getUsername())) {
			queryWrapper.likeRight("sys_org_code", "A04");
		}
		queryWrapper.likeRight("sys_org_code", "A04");
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		// 生成一级单位名称
		List<QcSsgqzysytdqkGzv> records = pageList.getRecords();
		List<QcSsgqzysytdqkGzv> firstOrgNames = qcSsgqzysytdqkGzvService.getFirstOrgNames(records);
		pageList.setRecords(firstOrgNames);
		return Result.OK(pageList);
	}
	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询", notes = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
	@GetMapping(value = "/list1")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList1(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
														   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
														   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
														   HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		List<Integer> sbzts = new ArrayList<>();
		sbzts.add(1);
		sbzts.add(2);
		queryWrapper.in("sfsb", sbzts);
		if (qcSsgqzysytdqk.getShzt() != null) {
			queryWrapper.eq("shzt", qcSsgqzysytdqk.getShzt());
		}
		//实际用途
//		if (qcSsgqzysytdqk.getSjyt() != null){
//			queryWrapper.eq("sjyt",qcSsgqzysytdqk.getSjyt());
//		}
		queryWrapper.likeRight("sys_org_code", "A04");
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}
	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-审核错误退回分页列表查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-审核错误退回分页列表查询", notes = "省属国企占有使用土地情况调查-审核错误退回分页列表查询")
	@GetMapping(value = "/list4")
	@PermissionData(pageComponent = "qcsb/QcSsgqzysytdqkList4")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList4(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
														@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
														@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
														HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		queryWrapper.eq("sfsb", 4);
		queryWrapper.likeRight("sys_org_code", "A04");
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}


	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询", notes = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
	@GetMapping(value = "/list2")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList2(QcSsgqzysytdqkGzv qcSsgqzysytdqk,String year,
														@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
														@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
														HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		List<Integer> sbzts = new ArrayList<>();
		sbzts.add(3);
		sbzts.add(4);
		queryWrapper.in("sfsb", sbzts);
		queryWrapper.likeRight("sys_org_code", "A04");
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		if (qcSsgqzysytdqk.getShzt() != null) {
			queryWrapper.eq("shzt", qcSsgqzysytdqk.getShzt());
		}
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

	/**
	 *
	 * @param qcSsgqzysytdqk
	 * @param year
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	@ApiOperation(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询", notes = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
	@GetMapping(value = "/listBygly")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageListBygly(QcSsgqzysytdqkGzv qcSsgqzysytdqk,String year,
															@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
															@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
															HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		queryWrapper.likeRight("sys_org_code", "A04");
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		List<QcSsgqzysytdqkGzv> records = pageList.getRecords();
		List<QcSsgqzysytdqkGzv> firstOrgNames = qcSsgqzysytdqkGzvService.getFirstOrgNames(records);
		pageList.setRecords(firstOrgNames);
		return Result.OK(pageList);
	}

	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-分页列表查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-分页列表查询", notes = "机关事业单位占有使用土地情况调查-分页列表查询")
	@GetMapping(value = "/list5")
	@PermissionData(pageComponent = "sydwqcsb/QcSsgqzysytdqkList")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList5(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
														@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
														@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
														HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		//List<Integer> sbzts = new ArrayList<>();
		//LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		queryWrapper.likeRight("sys_org_code", "A03");
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询", notes = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
	@GetMapping(value = "/list9")
	@PermissionData(pageComponent = "sydwqcsb/QcSsgqzysytdqkList4")

	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList9(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
														@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
														@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
														HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		List<Integer> sbzts = new ArrayList<>();
		sbzts.add(4);
		queryWrapper.in("sfsb", sbzts);
		queryWrapper.likeRight("sys_org_code", "A03");
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询", notes = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
	@GetMapping(value = "/list6")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList6(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
														@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
														@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
														HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		List sbzts = new ArrayList<>();
		sbzts.add(1);
		sbzts.add(2);
		queryWrapper.in("sfsb", sbzts);
		queryWrapper.likeRight("sys_org_code", "A03");
		if (qcSsgqzysytdqk.getShzt() != null) {
			queryWrapper.eq("shzt", qcSsgqzysytdqk.getShzt());
		}
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询", notes = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
	@GetMapping(value = "/list7")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList7(QcSsgqzysytdqkGzv qcSsgqzysytdqk,String year,
														@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
														@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
														HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		List<Integer> sbzts = new ArrayList<>();
		sbzts.add(3);
		sbzts.add(4);
		queryWrapper.in("sfsb", sbzts);
		queryWrapper.likeRight("sys_org_code", "A03");
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		if (qcSsgqzysytdqk.getShzt() != null) {
			queryWrapper.eq("shzt", qcSsgqzysytdqk.getShzt());
		}
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

	/**
	 * 编辑
	 *
	 * @param qcSsgqzysytdqk
	 * @return
	 */
	@AutoLog(value = "省属国企占有使用土地情况调查-编辑")
	@ApiOperation(value = "省属国企占有使用土地情况调查-编辑", notes = "省属国企占有使用土地情况调查-编辑")
	@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
	public Result<String> edit(@RequestBody QcSsgqzysytdqkGzv qcSsgqzysytdqk) {
		qcSsgqzysytdqkGzvService.updateById(qcSsgqzysytdqk);
		//
		if (qcSsgqzysytdqk.getSfsb() == 1) {
			this.sfsh(qcSsgqzysytdqk.getId());
		}
		if (qcSsgqzysytdqk.getShzt().equals("通过")) {
			//是否上报为3 审核通过状态
			qcSsgqzysytdqk.setSfsb(3);
			qcSsgqzysytdqkGzvService.updateById(qcSsgqzysytdqk);
		}
		return Result.OK("编辑成功!");
	}

	@AutoLog(value = "用地单位信息是否审核")
	@ApiOperation(value = "用地单位信息是否审核", notes = "用地单位信息是否审核")
	@GetMapping(value = "/sfsh")
	public Result<String> sfsh(String id) {
		QcSsgqzysytdqkGzv qk = qcSsgqzysytdqkGzvService.getById(id);
		if (qk.getSfsb() == 1) {
			qk.setSfsb(2);
			qcSsgqzysytdqkGzvService.saveOrUpdate(qk);
		}
		return Result.OK("审核中!");
	}

	/**
	 * 编辑
	 *
	 * @param qcSsgqzysytdqk
	 * @return
	 */
	@AutoLog(value = "省属国企占有使用土地情况调查-编辑")
	@ApiOperation(value = "省属国企占有使用土地情况调查-编辑", notes = "省属国企占有使用土地情况调查-编辑")
	@RequestMapping(value = "/edit1", method = {RequestMethod.PUT, RequestMethod.POST})
	public Result<String> edit1(@RequestBody QcSsgqzysytdqkGzv qcSsgqzysytdqk) {
		//当输入的为亩时
		if (qcSsgqzysytdqk.getSfsb() == 3) {
			qcSsgqzysytdqk.setSfsb(1);
			qcSsgqzysytdqkGzvService.saveOrUpdate(qcSsgqzysytdqk);
		}
		return Result.OK("变更成功!");
	}
	/**
	 * 通过id删除
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "省属国企占有使用土地情况调查-通过id删除")
	@ApiOperation(value = "省属国企占有使用土地情况调查-通过id删除", notes = "省属国企占有使用土地情况调查-通过id删除")
	@DeleteMapping(value = "/delete")
	public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
		qcSsgqzysytdqkGzvService.removeById(id);
		return Result.OK("删除成功!");
	}

	/**
	 * 批量删除
	 *
	 * @param ids
	 * @return
	 */
	@AutoLog(value = "省属国企占有使用土地情况调查-批量删除")
	@ApiOperation(value = "省属国企占有使用土地情况调查-批量删除", notes = "省属国企占有使用土地情况调查-批量删除")
	@DeleteMapping(value = "/deleteBatch")
	public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
		this.qcSsgqzysytdqkGzvService.removeByIds(Arrays.asList(ids.split(",")));
		return Result.OK("批量删除成功!");
	}

	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-通过id查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-通过id查询", notes = "省属国企占有使用土地情况调查-通过id查询")
	@GetMapping(value = "/queryById")
	public Result<QcSsgqzysytdqkGzv> queryById(@RequestParam(name = "id", required = true) String id) {
		QcSsgqzysytdqkGzv qcSsgqzysytdqk = qcSsgqzysytdqkGzvService.getById(id);
		if (qcSsgqzysytdqk == null) {
			return Result.error("未找到对应数据");
		}
		return Result.OK(qcSsgqzysytdqk);
	}

	/**
	 * 导出excel 省属企业
	 *
	 * @param request
	 * @param qcSsgqzysytdqk
	 */
	@RateLimiter(permitRate = 0.1, timeout = 5, timeUnit = TimeUnit.SECONDS)
	@RequestMapping(value = "/exportXls")
	@PermissionData(pageComponent = "qcsb/QcSsgqzysytdqkList")
	public ModelAndView exportXls(HttpServletRequest request, QcSsgqzysytdqkGzv qcSsgqzysytdqk,String year) {

		// Step.1 组装查询条件
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, request.getParameterMap());
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

		queryWrapper.likeRight("sys_org_code", "A04");
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		// Step.2 获取导出数据
		List<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.list(queryWrapper);
		List<QcSsgqzysytdqkGzv> exportList = null;

		// 过滤选中数据
		String selections = request.getParameter("selections");
		if (oConvertUtils.isNotEmpty(selections)) {
			List<String> selectionList = Arrays.asList(selections.split(","));
			exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
		} else {
			exportList = pageList;
		}
		for (QcSsgqzysytdqkGzv ssqydk : exportList) {
			ssqydk.setXq(ssqydk.getXzqh().substring(0, 4));
		}
		// Step.3 AutoPoi 导出Excel
		ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
		//此处设置的filename无效 ,前端会重更新设置一下
		mv.addObject(NormalExcelConstants.FILE_NAME, "省属国企占有使用土地情况调查");
		mv.addObject(NormalExcelConstants.CLASS, QcSsgqzysytdqkGzv.class);
		//update-begin--Author:liusq  Date:20210126 for：图片导出报错，ImageBasePath未设置--------------------
		ExportParams exportParams = new ExportParams("省属国企占有使用土地情况调查" + "报表", "导出人:" + sysUser.getRealname(), "省属国企占有使用土地情况调查");
		exportParams.setImageBasePath(upLoadPath);
		//update-end--Author:liusq  Date:20210126 for：图片导出报错，ImageBasePath未设置----------------------
		mv.addObject(NormalExcelConstants.PARAMS, exportParams);
		mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
		return mv;
	}

	/**
	 * 省直单位导出excel
	 *
	 * @param request
	 * @param qcSsgqzysytdqk
	 */
	@RequestMapping(value = "/exportXls2")
	@PermissionData(pageComponent = "sydwqcsb/QcSsgqzysytdqkList")
	public ModelAndView exportXls2(HttpServletRequest request, QcSsgqzysytdqk1 qcSsgqzysytdqk) {
		// Step.1 组装查询条件
		QueryWrapper<QcSsgqzysytdqk1> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, request.getParameterMap());
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

		// Step.2 获取导出数据
		List<QcSsgqzysytdqk1> pageList = qcSsgqzysytdqkService1.list(queryWrapper.likeRight("sys_org_code", "A03"));
		List<QcSsgqzysytdqk1> exportList = null;

		// 过滤选中数据
		String selections = request.getParameter("selections");
		if (oConvertUtils.isNotEmpty(selections)) {
			List<String> selectionList = Arrays.asList(selections.split(","));
			exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
		} else {
			exportList = pageList;
		}
		for (QcSsgqzysytdqk1 qcSsgqzysytdqk1 : exportList) {
			QueryWrapper<QcQyxx> qcQyxxQueryWrapper = new QueryWrapper<>();
			QcQyxx createBy = qcQyxxService.getOne(qcQyxxQueryWrapper.eq("create_by", qcSsgqzysytdqk1.getCreateBy()));
			qcSsgqzysytdqk1.setZgdw(createBy.getSjdw());
		}
		// Step.3 AutoPoi 导出Excel
		ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
		//此处设置的filename无效 ,前端会重更新设置一下
		mv.addObject(NormalExcelConstants.FILE_NAME, "用地单位占有使用土地情况调查");
		mv.addObject(NormalExcelConstants.CLASS, QcSsgqzysytdqk1.class);
		//update-begin--Author:liusq  Date:20210126 for：图片导出报错，ImageBasePath未设置--------------------
		ExportParams exportParams = new ExportParams("用地单位占有使用土地情况调查" + "报表", "导出人:" + sysUser.getRealname(), "用地单位占有使用土地情况调查");
		exportParams.setImageBasePath(upLoadPath);
		//update-end--Author:liusq  Date:20210126 for：图片导出报错，ImageBasePath未设置----------------------
		mv.addObject(NormalExcelConstants.PARAMS, exportParams);
		mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
		return mv;
	}

	/**
	 * 事业单位地块管理导出excel
	 *
	 * @param request
	 * @param qcSsgqzysytdqk
	 */
	@RequestMapping(value = "/exportXls3")
	@PermissionData(pageComponent = "sydwqcsb/QcSsgqzysytdqkList")
	public ModelAndView exportXls3(HttpServletRequest request, QcSsgqzysytdqk1 qcSsgqzysytdqk,String year) {
		// Step.1 组装查询条件
		QueryWrapper<QcSsgqzysytdqk1> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, request.getParameterMap());
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

		// Step.2 获取导出数据
		queryWrapper.likeRight("sys_org_code", "A03");
		queryWrapper.gt("sfsb", 0);
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		List<QcSsgqzysytdqk1> pageList = qcSsgqzysytdqkService1.list(queryWrapper);
		List<QcSsgqzysytdqk1> exportList = null;

		// 过滤选中数据
		String selections = request.getParameter("selections");
		if (oConvertUtils.isNotEmpty(selections)) {
			List<String> selectionList = Arrays.asList(selections.split(","));
			exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
		} else {
			exportList = pageList;
		}
		QueryWrapper<QcQyxx> qcQyxxQueryWrapper = new QueryWrapper<>();
		List<QcQyxx> list = qcQyxxService.list(qcQyxxQueryWrapper.likeRight("sys_org_code", "A03"));
		for (QcSsgqzysytdqk1 qcSsgqzysytdqk1 : exportList) {
			qcSsgqzysytdqk1.setXq(qcSsgqzysytdqk1.getXzqh().substring(0, 4));
			for (QcQyxx qcQyxx : list) {
				if (qcQyxx.getCreateBy().equals(qcSsgqzysytdqk1.getCreateBy())) {
					qcSsgqzysytdqk1.setZgdw(qcQyxx.getSjdw());
					break;
				}
			}
		}
		// Step.3 AutoPoi 导出Excel
		ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
		//此处设置的filename无效 ,前端会重更新设置一下
		mv.addObject(NormalExcelConstants.FILE_NAME, "用地单位占有使用土地情况调查");
		mv.addObject(NormalExcelConstants.CLASS, QcSsgqzysytdqk1.class);
		//update-begin--Author:liusq  Date:20210126 for：图片导出报错，ImageBasePath未设置--------------------
		ExportParams exportParams = new ExportParams("用地单位占有使用土地情况调查" + "报表", "导出人:" + sysUser.getRealname(), "用地单位占有使用土地情况调查");
		exportParams.setImageBasePath(upLoadPath);
		//update-end--Author:liusq  Date:20210126 for：图片导出报错，ImageBasePath未设置----------------------
		mv.addObject(NormalExcelConstants.PARAMS, exportParams);
		mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
		return mv;
	}

	/**
	 * 通过excel导入数据
	 *
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
	public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
		return super.importExcel(request, response, QcSsgqzysytdqkGzv.class);
	}

	/**
	 * 事业单位通过excel导入数据
	 *
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/importExcel2", method = RequestMethod.POST)
	public Result<?> importExcel2(HttpServletRequest request, HttpServletResponse response) {
		MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
		Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
			// 获取上传文件对象
			MultipartFile file = entity.getValue();
			ImportParams params = new ImportParams();
			params.setTitleRows(2);
			params.setHeadRows(1);
			params.setNeedSave(true);
			try {
				List<QcSsgqzysytdqk1> list = ExcelImportUtil.importExcel(file.getInputStream(), QcSsgqzysytdqk1.class, params);
				//update-begin-author:taoyan date:20190528 for:批量插入数据
				for (QcSsgqzysytdqk1 qcSsgqzysytdqk : list) {
					qcSsgqzysytdqk.setSysOrgCode(sysUser.getOrgCode());
					qcSsgqzysytdqk.setSfsb(0);
					qcSsgqzysytdqk.setSjsyjzmjdw("平方米");
				}
				long start = System.currentTimeMillis();
				qcSsgqzysytdqkService1.saveBatch(list);
				//400条 saveBatch消耗时间1592毫秒  循环插入消耗时间1947毫秒
				//1200条  saveBatch消耗时间3687毫秒 循环插入消耗时间5212毫秒
				log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒");
				//update-end-author:taoyan date:20190528 for:批量插入数据
				return Result.ok("文件导入成功！数据行数：" + list.size());
			} catch (Exception e) {
				//update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
				String msg = e.getMessage();
				log.error(msg, e);
				if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
					return Result.error("文件导入失败:有重复数据！");
				} else {
					return Result.error("文件导入失败:" + e.getMessage());
				}
				//update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
			} finally {
				try {
					file.getInputStream().close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return Result.error("文件导入失败！");
	}
	/*----------------------------------------------暂存开始------------------------------------------------*/

	/**
	 * 添加
	 *
	 * @param qcSsgqzysytdqk
	 * @return
	 */
	@AutoLog(value = "省直单位占有使用土地情况调查-添加暂存")
	@ApiOperation(value = "省直单位占有使用土地情况调查-添加暂存", notes = "省直单位占有使用土地情况调查-添加暂存")
	@PostMapping(value = "/addStag")
	public Result<String> addStag(@RequestBody QcSsgqzysytdqkzc qcSsgqzysytdqk) {
		qcSsgqzysytdqkzcService.save(qcSsgqzysytdqk);
		return Result.OK("暂存成功！请到草稿箱查看！");
	}

	/**
	 * 草稿箱分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-分页列表查询")
	@ApiOperation(value = "草稿箱分页列表查询", notes = "草稿箱分页列表查询")
	@GetMapping(value = "/listStag")
	@PermissionData(pageComponent = "sydwqcsb/listStag")
	public Result<IPage<QcSsgqzysytdqkzc>> queryPagelistStag(QcSsgqzysytdqkzc qcSsgqzysytdqk,
															 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
															 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
															 HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkzc> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkzc> page = new Page<QcSsgqzysytdqkzc>(pageNo, pageSize);
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		queryWrapper.eq("sys_org_code", sysUser.getOrgCode());
		IPage<QcSsgqzysytdqkzc> pageList = qcSsgqzysytdqkzcService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

	/**
	 * 暂存
	 *
	 * @param qcSsgqzysytdqk
	 * @return
	 */
	@AutoLog(value = "暂存")
	@ApiOperation(value = "暂存", notes = "暂存")
	@RequestMapping(value = "/editStag", method = {RequestMethod.PUT, RequestMethod.POST})
	public Result<String> editStag(@RequestBody QcSsgqzysytdqkzc qcSsgqzysytdqk) {
		qcSsgqzysytdqkzcService.saveOrUpdate(qcSsgqzysytdqk);
		return Result.OK("暂存成功!");
	}

	/**
	 * 将地块暂存转为填报列表
	 *
	 * @param qcSsgqzysytdqk
	 * @return
	 */
	@AutoLog(value = "将地块暂存转为填报列表-编辑")
	@ApiOperation(value = "将地块暂存转为填报列表-编辑", notes = "将地块暂存转为填报列表-编辑")
	@RequestMapping(value = "/addToList", method = {RequestMethod.PUT, RequestMethod.POST})
	public Result<String> addToList(@RequestBody QcSsgqzysytdqkzc qcSsgqzysytdqk) {
		QcSsgqzysytdqkGzv result = new QcSsgqzysytdqkGzv();
		BeanUtils.copyProperties(qcSsgqzysytdqk, result);
		this.add2(result);
		qcSsgqzysytdqkzcService.removeById(qcSsgqzysytdqk.getId());
		return Result.OK("转入成功!");
	}

	/**
	 * 通过id删除
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "省属国企占有使用土地情况调查-通过id删除")
	@ApiOperation(value = "省属国企占有使用土地情况调查-通过id删除", notes = "省属国企占有使用土地情况调查-通过id删除")
	@DeleteMapping(value = "/deleteStag")
	public Result<String> deleteStag(@RequestParam(name = "id", required = true) String id) {
		qcSsgqzysytdqkzcService.removeById(id);
		return Result.OK("删除成功!");
	}

	/**
	 * 通过DKBH进行查询
	 *
	 * @param DKBH
	 * @return
	 */
	@AutoLog(value = "省属国企占有使用土地情况调查-通过DKBH进行查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-通过DKBH进行查询", notes = "省属国企占有使用土地情况调查-通过DKBH进行查询")
	@GetMapping(value = "/queryBydkbh")
	public Result<QcSsgqzysytdqkGzvVo> queryBydkbh(@RequestParam(name = "DKBH", required = true) String DKBH) {
		LambdaQueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(QcSsgqzysytdqkGzv::getDkbh, DKBH);
		QcSsgqzysytdqkGzv one = qcSsgqzysytdqkGzvService.getOne(queryWrapper);
		QcSsgqzysytdqkGzvVo Vo = new QcSsgqzysytdqkGzvVo();
		if (one!=null){
			BeanUtils.copyProperties(one, Vo);
			if (ENTERPRISE_CODE_SQ.equals(one.getSysOrgCode().substring(0, 3))) {
				//查询字典
				List<String> strings = sysBaseAPI.loadCategoryDictItem(one.getSjyt());
				if (strings.size()>0){
					Vo.setSjytText(strings.get(0));
				}
				List<String> pzyt = sysBaseAPI.loadCategoryDictItem(one.getPzyt());
				if(pzyt.size()>0){
					Vo.setPzytText(pzyt.get(0));
				}
			} else if (ENTERPRISE_CODE_SZ.equals(one.getSysOrgCode().substring(0, 3))) {
				Vo.setSjytText(one.getSjyt());
				Vo.setPzytText(one.getPzyt());
			}
		}
		//计算地价
		List<SsDkjz> ssDkjz=ssDkzjService.queryList(DKBH);
		Vo.setSsDkjz(ssDkjz);
		return Result.OK("查询成功!", Vo);
	}

	/**
	 * 列表查询图表统计
	 *
	 * @param qcSsgqzysytdqk
	 * @param req
	 * @return
	 */
	/**
	 * @AutoLog(value = "省属列表数据查询)
	 */
	@ApiOperation(value = "省属列表数据查询", notes = "省属列表数据查询")
	@GetMapping(value = "/sumList")
	@PermissionData(pageComponent = "qcsb/QcSsgqzysytdqkList")
	public Result<?> queryPageList(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
								   HttpServletRequest req,String year) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		queryWrapper.likeRight("sys_org_code", "A04");
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		List<QcSsgqzysytdqkGzv> list = qcSsgqzysytdqkGzvService.list(queryWrapper);
		List<Map<String, Double>> map = qcSsgqzysytdqkGzvService.sumList(list);
		return Result.OK(map);
	}

	/**
	 * 列表查询图表统计
	 *
	 * @param qcSsgqzysytdqk
	 * @param req
	 * @return
	 */
	/**
	 * @AutoLog(value = "省直列表数据查询)
	 */
	@ApiOperation(value = "省直列表数据查询", notes = "省直列表数据查询")
	@GetMapping(value = "/sumListBysz")
	public Result<?> sumListBysz(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
								 HttpServletRequest req,String year) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		queryWrapper.likeRight("sys_org_code", "A03");
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		List<QcSsgqzysytdqkGzv> list = qcSsgqzysytdqkGzvService.list(queryWrapper);
		List<Map<String, Double>> map = qcSsgqzysytdqkGzvService.sumListBysz(list);
		return Result.OK(map);
	}

	/**
	 * 更新图片
	 *
	 * @param qcSsgqzysytdqk
	 * @param req
	 * @return
	 */
	/**
	 * @AutoLog(value = "更新图片)
	 */
	@ApiOperation(value = "更新图片", notes = "更新图片")
	@GetMapping(value = "/updateImages")
	public Result<?> updateImages() {
		List<QcSsgqzysytdqkGzv> list = qcSsgqzysytdqkGzvService.list();
		//初始目录
		File dir = new File("D:\\images\\temp");
		Date beginDate = new Date();
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String beginDateStr = simpleDateFormat.format(beginDate);
		System.out.println("开始时间：" + beginDateStr);
		printDirByRecursive(dir, 2,list);
		//searchDir(dir);
		Date endDate = new Date();
		String endDateStr = simpleDateFormat.format(endDate);
		System.out.println("结束时间：" + endDateStr);
		return Result.OK("成功");
	}

	/**
	 * 遍历文件夹（递归）
	 *
	 * @param dir
	 * @param level
	 */
	public  void printDirByRecursive(File dir, int level,List<QcSsgqzysytdqkGzv> qcSsgqzysytdqks) {
		//System.out.println(dir.getAbsolutePath());
		//输出层次数
//        for (int i = 0; i < level; i++) {
//            System.out.print("-");
//        }
		//获取这个目录下所有的子文件和子目录的数组。
		Map map=new HashMap<>();
		List list = new ArrayList<>();
		File[] files = dir.listFiles();
		String a=null;
		//遍历这个数组，取出每个File对象
		if (files != null) {
			for (File f : files) {
				//判断这个File是否是一个文件，是：
				if (f.isFile() ) {
					a = f.getParentFile().getName();
//                    System.out.println(f.toString().substring(10));
					if(a.equals(f.getParentFile().getName())&& !f.getParentFile().getName().equals("desktop.ini")){
						list.add(f.toString().substring(10));
					}
				} else {//否则就是一个目录，继续递归
					//递归调用
					printDirByRecursive(f, level,qcSsgqzysytdqks);
				}
			}
			if(list.size()>0){
				for (QcSsgqzysytdqkGzv qcSsgqzysytdqk : qcSsgqzysytdqks) {
					if(qcSsgqzysytdqk.getDkbh().equals(a)){
						System.out.println(a);
						UpdateWrapper<QcSsgqzysytdqkGzv> updateWrapper = new UpdateWrapper<>();
						updateWrapper.eq("DKBH",a);
						updateWrapper.set("IMAGES", StringUtils.join(list,","));
						qcSsgqzysytdqkGzvService.update(null,updateWrapper);
					}
				}
			}
		}
	}
	@ApiOperation(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询", notes = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
	@GetMapping(value = "/listByglyy")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageListBygly2(QcSsgqzysytdqkGzv qcSsgqzysytdqk,String year,
																@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
																@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
																HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		queryWrapper.likeRight("sys_org_code", "A03");
		queryWrapper.gt("sfsb", 0);
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

	/**
	 *
	 * @AutoLog(value = "查询地块数量和面积")
	 * @param qcSsgqzysytdqk
	 * @param year
	 * @param req
	 * @return
	 */
	@ApiOperation(value = "查询地块数量和面积", notes = "查询地块数量和面积")
	@GetMapping(value = "/listByglyyCount")
	public Result<ResultCount> queryPageListByglyyCount(QcSsgqzysytdqkGzv qcSsgqzysytdqk,String year,HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		queryWrapper.likeRight("sys_org_code", "A03");
		queryWrapper.gt("sfsb", 0);
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		ResultCount resultCount = qcSsgqzysytdqkGzvService.queryResultCount(queryWrapper);
		if (resultCount==null){
			resultCount = new ResultCount();
			resultCount.setAreaDk(0.0);
			resultCount.setCountDk(0);
		}
		return Result.OK(resultCount);
	}
	/**
	 *
	 * @AutoLog(value = "查询地块数量和面积")
	 * @param qcSsgqzysytdqk
	 * @param year
	 * @param req
	 * @return
	 */
	@ApiOperation(value = "查询地块数量和面积", notes = "查询地块数量和面积")
	@GetMapping(value = "/listByglyCount")
	public Result<ResultCount> queryPageListByglyCount(QcSsgqzysytdqkGzv qcSsgqzysytdqk,String year,HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		queryWrapper.likeRight("sys_org_code", "A04");
		if (year!=null){
			queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
		}
		ResultCount resultCount = qcSsgqzysytdqkGzvService.queryResultCount(queryWrapper);
		if (resultCount==null){
			resultCount = new ResultCount();
			resultCount.setAreaDk(0.0);
			resultCount.setCountDk(0);
		}
		return Result.OK(resultCount);
	}

	@AutoLog(value = "用地单位信息是否可以撤回")
	@ApiOperation(value = "用地单位信息是否可以撤回", notes = "用地单位信息是否可以撤回")
	@GetMapping(value = "/sfch")
	public Result<String> sfch(String id) {
		QcSsgqzysytdqkGzv qk = new QcSsgqzysytdqkGzv();
		qk = qcSsgqzysytdqkGzvService.getById(id);
		if (qk.getSfsb() == 1) {
			qk.setSfsb(0);
			qcSsgqzysytdqkGzvService.saveOrUpdate(qk);
			return Result.OK("撤回成功!");
		}
		return Result.error("无法撤回！");

	}

//    @AutoLog(value = "用地单位信息是否审核")
//    @ApiOperation(value = "用地单位信息是否审核", notes = "用地单位信息是否审核")
//    @GetMapping(value = "/sfsh")
//    public Result<String> sfsh(String id) {
//        QcSsgqzysytdqk qk = new QcSsgqzysytdqk();
//        qk = qcSsgqzysytdqkService.getById(id);
//        if (qk.getSfsb() == 1) {
//            qk.setSfsb(2);
//            qcSsgqzysytdqkService.saveOrUpdate(qk);
//        }
//        return Result.OK("审核中!");
//    }

	@AutoLog(value = "用地单位信息重新上报")
	@ApiOperation(value = "用地单位信息重新上报", notes = "用地单位信息重新上报")
	@GetMapping(value = "/cxsb")
	public Result<String> cxsb(String id) {
		QcSsgqzysytdqkGzv qk = new QcSsgqzysytdqkGzv();
		qk = qcSsgqzysytdqkGzvService.getById(id);
		if (qk.getSfsb() == 4) {
			qk.setSfsb(0);
			qcSsgqzysytdqkGzvService.saveOrUpdate(qk);
		}
		return Result.OK("审核中!");
	}

	@GetMapping(value = "/wjcl")
	public Result<String> wjcl() throws IOException {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = new QueryWrapper<>();
		queryWrapper.isNotNull("zbwzxgzmcl");
		List<QcSsgqzysytdqkGzv> list = qcSsgqzysytdqkGzvService.list(queryWrapper);
		for (QcSsgqzysytdqkGzv qcSsgqzysytdqk : list) {
			String wjbh = qcSsgqzysytdqk.getWjbh().trim();
			String zbwzxgzmcl = qcSsgqzysytdqk.getZbwzxgzmcl();
			if (zbwzxgzmcl.contains(",")) {
				String[] split = zbwzxgzmcl.split(",");
				List<String> strings = Arrays.asList(split);
				for (int i = 0; i < strings.toArray().length; i++) {
					String str1 = strings.get(i).substring(0, strings.get(i).indexOf("."));
					String str2 = strings.get(i).substring(str1.length(), strings.get(i).length());
					System.out.println(str2);
					/*File result =new File("D:/opt/result/"+wjbh+i+str2);*/
					File result = new File("D:/opt/result/" + wjbh + i + str2);
					if (!result.getParentFile().exists()) {
						result.getParentFile().mkdirs();
					}
					//需要复制的原图的路径+图片名+ .png(这是该图片的格式)
					/*FileInputStream input = new FileInputStream("D:/upload/"+strings.get(i));*/
					FileInputStream input = new FileInputStream("D:/upload/" + strings.get(i));
					FileOutputStream out = new FileOutputStream(result);
					//一个容量，相当于打水的桶，可以自定义大小
					byte[] buffer = new byte[100];
					int hasRead = 0;
					while ((hasRead = input.read(buffer)) > 0) {
						//0：表示每次从0开始
						out.write(buffer, 0, hasRead);
					}
					System.out.println(result.getAbsolutePath());
					input.close();
					out.close();
				}
			} else {
				String str1 = zbwzxgzmcl.substring(0, zbwzxgzmcl.indexOf("."));
				String str2 = zbwzxgzmcl.substring(str1.length(), zbwzxgzmcl.length());
				System.out.println(str2);
				File result = new File("D:/opt/result/" + wjbh + str2);

				if (!result.getParentFile().exists()) {
					result.getParentFile().mkdirs();
				}

				//需要复制的原图的路径+图片名+ .png(这是该图片的格式)
				FileInputStream input = new FileInputStream("D:/upload/" + zbwzxgzmcl);
				FileOutputStream out = new FileOutputStream(result);
				//一个容量，相当于打水的桶，可以自定义大小
				byte[] buffer = new byte[100];
				int hasRead = 0;
				while ((hasRead = input.read(buffer)) > 0) {
					//0：表示每次从0开始
					out.write(buffer, 0, hasRead);
				}
				input.close();
				out.close();
			}
		}

		return Result.OK(" ");
	}


	@AutoLog(value = "用地单位信息审核结果")
	@ApiOperation(value = "用地单位信息审核结果", notes = "用地单位信息审核结果")
	@GetMapping(value = "/wcsh")
	public Result<String> wcsh(String id) {
		QcSsgqzysytdqkGzv qk= qcSsgqzysytdqkGzvService.getById(id);
		if (qk.getShzt() != null) {
			if (qk.getShzt().equals("通过")) {
				qk.setSfsb(3);
			} else if (qk.getShzt().equals("不通过")) {
				qk.setSfsb(4);
			}
			LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
			String username = sysUser.getUsername();
			qk.setShren(username);
			Date date = new Date();
			qk.setShrq(date);
			qcSsgqzysytdqkGzvService.saveOrUpdate(qk);
			return Result.OK("完成审核!");
		} else {
			return Result.error("请先进行审核！");
		}
	}

	@AutoLog(value = "用地单位信息审核结果")
	@ApiOperation(value = "用地单位信息审核结果", notes = "用地单位信息审核结果")
	@GetMapping(value = "/hfysh")
	public Result<String> hfysh(String id) {
		QcSsgqzysytdqkGzv qk = new QcSsgqzysytdqkGzv();
		qk = qcSsgqzysytdqkGzvService.getById(id);
		qk.setSfsb(3);
		qk.setShzt("通过");
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		String username = sysUser.getUsername();
		qk.setShren(username);
		Date date = new Date();
		qk.setShrq(date);
		qcSsgqzysytdqkGzvService.saveOrUpdate(qk);
		return Result.OK("已经恢复!");
	}

	/**
	 * 分页列表查询
	 *
	 * @param qcSsgqzysytdqk
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "省属国企占有使用土地情况调查-审核正确的分页列表查询")
	@ApiOperation(value = "省属国企占有使用土地情况调查-审核正确的分页列表查询", notes = "省属国企占有使用土地情况调查-审核正确的分页列表查询")
	@GetMapping(value = "/list3")
	public Result<IPage<QcSsgqzysytdqkGzv>> queryPageList3(QcSsgqzysytdqkGzv qcSsgqzysytdqk,
														   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
														   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
														   HttpServletRequest req) {
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
		Page<QcSsgqzysytdqkGzv> page = new Page<QcSsgqzysytdqkGzv>(pageNo, pageSize);
		queryWrapper.eq("sfsb", 3);
		IPage<QcSsgqzysytdqkGzv> pageList = qcSsgqzysytdqkGzvService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

	/**
	 * 查询是否存在用地单位信息
	 *
	 * @return
	 */
	@AutoLog(value = "省属国企占有使用土地情况调查-添加")
	@ApiOperation(value = "省属国企占有使用土地情况调查-添加", notes = "省属国企占有使用土地情况调查-添加")
	@GetMapping(value = "/selectQyxx")
	public Result<?> selectQyxx() {
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		String username = sysUser.getUsername();
		String orgCode = sysUser.getOrgCode();
		//可用 qcSsgqzysytdqkService
		QcQyxx qcQyxx = qcSsgqzysytdqkGzvService.selectQyxx(username, orgCode);
		if (qcQyxx.getTyshxybm() != null && qcQyxx.getSfsb() > 0) {
			return Result.ok(qcQyxx);
		}
		return Result.error("请补全用地单位信息并进行上报");
	}

	/**
	 * 添加
	 *
	 * @param qcSsgqzysytdqk
	 * @return
	 */
	@AutoLog(value = "省属国企占有使用土地情况调查-添加")
	@ApiOperation(value = "省属国企占有使用土地情况调查-添加", notes = "省属国企占有使用土地情况调查-添加")
	@PostMapping(value = "/add")
	public Result<String> add(@RequestBody QcSsgqzysytdqkGzv qcSsgqzysytdqk) {
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		QueryWrapper queryWrapper = new QueryWrapper<>();
		if (sysUser.getOrgCode().substring(0, 3).equals("A04")) {
			queryWrapper.likeRight("sys_org_code", "A04");
			queryWrapper.orderByDesc("DKBH");
			List<QcSsgqzysytdqkGzv> list = qcSsgqzysytdqkGzvService.list(queryWrapper);
			QcSsgqzysytdqkGzv qcdk = list.get(0);
			if (StringUtils.isNotEmpty(qcdk.getDkbh())) {
				qcSsgqzysytdqk.setDkbh("SQ" + (Integer.valueOf(qcdk.getDkbh().substring(qcdk.getDkbh().length() - 4, qcdk.getDkbh().length())) + 1));
			}
			//可用qcSsgqzysytdqkService
			QcQyxx qcQyxx = qcSsgqzysytdqkGzvService.selectQyxx(sysUser.getUsername(), sysUser.getOrgCode());
			//qcSsgqzysytdqk.setTyshxydm(qcQyxx.getTyshxybm());
			qcSsgqzysytdqk.setSjdw(qcQyxx.getSjdw()); //上级单位
			//qcSsgqzysytdqk.setJglx(qcQyxx.getJglx());
		}
//        if (qcSsgqzysytdqk.getSjzytdmjdw().equals("1")) {
//            qcSsgqzysytdqk.setSjzytdmjGq(Zh.MzGq(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjPf(Zh.MzP(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjM(qcSsgqzysytdqk.getSjzytdmj());
//            qcSsgqzysytdqk.setQzpztdmjGq(Zh.MzGq(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjPf(Zh.MzP(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjM(qcSsgqzysytdqk.getQzpzsymj());
//
//        }
		//当输入的为公顷时
//        else if (qcSsgqzysytdqk.getSjzytdmjdw().equals("2")) {
//            qcSsgqzysytdqk.setSjzytdmjPf(Zh.GqZp(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjM(Zh.GqZm(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjGq(qcSsgqzysytdqk.getSjzytdmj());
//            qcSsgqzysytdqk.setQzpztdmjPf(Zh.GqZp(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjM(Zh.GqZm(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjGq(qcSsgqzysytdqk.getQzpzsymj());
//        } else if (qcSsgqzysytdqk.getSjzytdmjdw().equals("3")) {//当输入的为平方米时
//            qcSsgqzysytdqk.setSjzytdmjM(Zh.PzM(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjGq(Zh.PzGq(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjPf(qcSsgqzysytdqk.getSjzytdmj());
//            qcSsgqzysytdqk.setQzpztdmjM(Zh.PzM(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjGq(Zh.PzGq(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjPf(qcSsgqzysytdqk.getQzpzsymj());
//        }
//        if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("1")) {//当输入的为亩时
//            qcSsgqzysytdqk.setSjsyjzmjGq(Zh.MzGq(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjPf(Zh.MzP(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjM(qcSsgqzysytdqk.getSjsyjzmj());
//            qcSsgqzysytdqk.setQzpzjzmjGq(Zh.MzGq(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjPf(Zh.MzP(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjM(qcSsgqzysytdqk.getQzpzsymj2());
//        } else if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("2")) {//当输入的为公顷时
//            qcSsgqzysytdqk.setSjsyjzmjM(Zh.GqZm(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjPf(Zh.GqZp(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjGq(qcSsgqzysytdqk.getSjsyjzmj());
//            qcSsgqzysytdqk.setQzpzjzmjM(Zh.GqZm(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjPf(Zh.GqZp(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjGq(qcSsgqzysytdqk.getQzpzsymj2());
//        } else if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("3")) {//当输入的为平方米时
//            qcSsgqzysytdqk.setSjsyjzmjGq(Zh.PzGq(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjM(Zh.PzM(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjPf(qcSsgqzysytdqk.getSjsyjzmj());
//            qcSsgqzysytdqk.setQzpzjzmjGq(Zh.PzGq(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjM(Zh.PzM(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjPf(qcSsgqzysytdqk.getQzpzsymj2());
//        }
		qcSsgqzysytdqkGzvService.save(qcSsgqzysytdqk);
		return Result.OK("添加成功！");
	}

	/**
	 * 添加
	 *
	 * @param qcSsgqzysytdqk
	 * @return
	 */
	@AutoLog(value = "省直单位有使用土地情况调查-添加")
	@ApiOperation(value = "省直单位有使用土地情况调查-添加", notes = "省直单位有使用土地情况调查-添加")
	@PostMapping(value = "/add2")
	public Result<String> add2(@RequestBody QcSsgqzysytdqkGzv qcSsgqzysytdqk) {
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		QueryWrapper queryWrapper = new QueryWrapper<>();
		queryWrapper.likeRight("sys_org_code", "A03");
		queryWrapper.orderByDesc("DKBH");
		List<QcSsgqzysytdqkGzv> list = qcSsgqzysytdqkGzvService.list(queryWrapper);
		QcSsgqzysytdqkGzv qcdk = list.get(0);
		if (StringUtils.isNotEmpty(qcdk.getDkbh())) {
			qcSsgqzysytdqk.setDkbh("SZ" + (Integer.valueOf(qcdk.getDkbh().substring(qcdk.getDkbh().length() - 4, qcdk.getDkbh().length())) + 1));
		}
//        if (StringUtils.isNotEmpty(qcSsgqzysytdqk.getSjzytdmjdw()) && qcSsgqzysytdqk.getSjzytdmjdw().equals("1")) {
//            qcSsgqzysytdqk.setSjzytdmjGq(Zh.MzGq(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjPf(Zh.MzP(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjM(qcSsgqzysytdqk.getSjzytdmj());
//            qcSsgqzysytdqk.setQzpztdmjGq(Zh.MzGq(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjPf(Zh.MzP(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjM(qcSsgqzysytdqk.getQzpzsymj());
//        } else if (StringUtils.isNotEmpty(qcSsgqzysytdqk.getSjzytdmjdw()) && qcSsgqzysytdqk.getSjzytdmjdw().equals("2")) {//当输入的为公顷时
//            qcSsgqzysytdqk.setSjzytdmjPf(Zh.GqZp(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjM(Zh.GqZm(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjGq(qcSsgqzysytdqk.getSjzytdmj());
//            qcSsgqzysytdqk.setQzpztdmjPf(Zh.GqZp(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjM(Zh.GqZm(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjGq(qcSsgqzysytdqk.getQzpzsymj());
//        } else if (StringUtils.isNotEmpty(qcSsgqzysytdqk.getSjzytdmjdw()) && qcSsgqzysytdqk.getSjzytdmjdw().equals("3")) {//当输入的为平方米时
//            qcSsgqzysytdqk.setSjzytdmjM(Zh.PzM(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjGq(Zh.PzGq(qcSsgqzysytdqk.getSjzytdmj()));
//            qcSsgqzysytdqk.setSjzytdmjPf(qcSsgqzysytdqk.getSjzytdmj());
//            qcSsgqzysytdqk.setQzpztdmjM(Zh.PzM(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjGq(Zh.PzGq(qcSsgqzysytdqk.getQzpzsymj()));
//            qcSsgqzysytdqk.setQzpztdmjPf(qcSsgqzysytdqk.getQzpzsymj());
//        }
//        if (StringUtils.isNotEmpty(qcSsgqzysytdqk.getSjsyjzmjdw()) && qcSsgqzysytdqk.getSjsyjzmjdw().equals("1")) {//当输入的为亩时
//            qcSsgqzysytdqk.setSjsyjzmjGq(Zh.MzGq(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjPf(Zh.MzP(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjM(qcSsgqzysytdqk.getSjsyjzmj());
//            qcSsgqzysytdqk.setQzpzjzmjGq(Zh.MzGq(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjPf(Zh.MzP(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjM(qcSsgqzysytdqk.getQzpzsymj2());
//        } else if (StringUtils.isNotEmpty(qcSsgqzysytdqk.getSjsyjzmjdw()) && qcSsgqzysytdqk.getSjsyjzmjdw().equals("2")) {//当输入的为公顷时
//            qcSsgqzysytdqk.setSjsyjzmjM(Zh.GqZm(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjPf(Zh.GqZp(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjGq(qcSsgqzysytdqk.getSjsyjzmj());
//            qcSsgqzysytdqk.setQzpzjzmjM(Zh.GqZm(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjPf(Zh.GqZp(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjGq(qcSsgqzysytdqk.getQzpzsymj2());
//        } else if (StringUtils.isNotEmpty(qcSsgqzysytdqk.getSjsyjzmjdw()) && qcSsgqzysytdqk.getSjsyjzmjdw().equals("3")) {//当输入的为平方米时
//            qcSsgqzysytdqk.setSjsyjzmjGq(Zh.PzGq(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjM(Zh.PzM(qcSsgqzysytdqk.getSjsyjzmj()));
//            qcSsgqzysytdqk.setSjsyjzmjPf(qcSsgqzysytdqk.getSjsyjzmj());
//            qcSsgqzysytdqk.setQzpzjzmjGq(Zh.PzGq(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjM(Zh.PzM(qcSsgqzysytdqk.getQzpzsymj2()));
//            qcSsgqzysytdqk.setQzpzjzmjPf(qcSsgqzysytdqk.getQzpzsymj2());
//        }
		qcSsgqzysytdqkGzvService.save(qcSsgqzysytdqk);
		return Result.OK("添加成功！");
	}

	/**
	 * 添加
	 */
	@AutoLog(value = "查询存在的用户")
	@ApiOperation(value = "查询存在的用户-添加", notes = "查询存在的用户-添加")
	@GetMapping(value = "/selectUser")
	public Result<QcSsgqzysytdqkGzv> selectUser() {
		QcSsgqzysytdqkGzv qcSsgqzysytdqk = null;
		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		String orgCode = sysUser.getOrgCode();
		QueryWrapper<QcSsgqzysytdqkGzv> queryWrapper = new QueryWrapper<QcSsgqzysytdqkGzv>();
		queryWrapper.eq("sys_org_code", orgCode);
		List<QcSsgqzysytdqkGzv> list = qcSsgqzysytdqkGzvService.list(queryWrapper);
		if (list.size() > 0) {
			qcSsgqzysytdqk = list.get(0);
		}

		return Result.ok(qcSsgqzysytdqk);
	}


	//    /**
//     * 编辑
//     *
//     * @param qcSsgqzysytdqk
//     * @return
//     */
//    @AutoLog(value = "省属国企占有使用土地情况调查-编辑")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-编辑", notes = "省属国企占有使用土地情况调查-编辑")
//    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
//    public Result<String> edit(@RequestBody QcSsgqzysytdqk qcSsgqzysytdqk) {
//        qcSsgqzysytdqkService.updateById(qcSsgqzysytdqk);
//        //当输入的为亩时
//        if (qcSsgqzysytdqk.getSfsb() == 0) {
//            if (qcSsgqzysytdqk.getSjzytdmjdw().equals("1")) {
//                qcSsgqzysytdqk.setSjzytdmjGq(Zh.MzGq(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjPf(Zh.MzP(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjM(qcSsgqzysytdqk.getSjzytdmj());
//                qcSsgqzysytdqk.setQzpztdmjGq(Zh.MzGq(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjPf(Zh.MzP(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjM(qcSsgqzysytdqk.getQzpzsymj());
//            } else if (qcSsgqzysytdqk.getSjzytdmjdw().equals("2")) {//当输入的为公顷时
//                qcSsgqzysytdqk.setSjzytdmjPf(Zh.GqZp(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjM(Zh.GqZm(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjGq(qcSsgqzysytdqk.getSjzytdmj());
//                qcSsgqzysytdqk.setQzpztdmjPf(Zh.GqZp(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjM(Zh.GqZm(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjGq(qcSsgqzysytdqk.getQzpzsymj());
//            } else if (qcSsgqzysytdqk.getSjzytdmjdw().equals("3")) {//当输入的为平方米时
//                qcSsgqzysytdqk.setSjzytdmjM(Zh.PzM(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjGq(Zh.PzGq(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjPf(qcSsgqzysytdqk.getSjzytdmj());
//                qcSsgqzysytdqk.setQzpztdmjM(Zh.PzM(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjGq(Zh.PzGq(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjPf(qcSsgqzysytdqk.getQzpzsymj());
//            }
//            if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("1")) {//当输入的为亩时
//                qcSsgqzysytdqk.setSjsyjzmjGq(Zh.MzGq(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjPf(Zh.MzP(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjM(qcSsgqzysytdqk.getSjsyjzmj());
//                qcSsgqzysytdqk.setQzpzjzmjGq(Zh.MzGq(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjPf(Zh.MzP(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjM(qcSsgqzysytdqk.getQzpzsymj2());
//            } else if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("2")) {//当输入的为公顷时
//                qcSsgqzysytdqk.setSjsyjzmjM(Zh.GqZm(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjPf(Zh.GqZp(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjGq(qcSsgqzysytdqk.getSjsyjzmj());
//                qcSsgqzysytdqk.setQzpzjzmjM(Zh.GqZm(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjPf(Zh.GqZp(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjGq(qcSsgqzysytdqk.getQzpzsymj2());
//            } else if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("3")) {//当输入的为平方米时
//                qcSsgqzysytdqk.setSjsyjzmjGq(Zh.PzGq(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjM(Zh.PzM(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjPf(qcSsgqzysytdqk.getSjsyjzmj());
//                qcSsgqzysytdqk.setQzpzjzmjGq(Zh.PzGq(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjM(Zh.PzM(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjPf(qcSsgqzysytdqk.getQzpzsymj2());
//            }
//
//            qcSsgqzysytdqkService.saveOrUpdate(qcSsgqzysytdqk);
//
//        } else if (qcSsgqzysytdqk.getSfsb() == 1) {
//            this.sfsh(qcSsgqzysytdqk.getId());
//        }
//        return Result.OK("编辑成功!");
//    }


//    /**
//     * 编辑
//     *
//     * @param qcSsgqzysytdqk
//     * @return
//     */
//    @AutoLog(value = "省属国企占有使用土地情况调查-编辑")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-编辑", notes = "省属国企占有使用土地情况调查-编辑")
//    @RequestMapping(value = "/edit1", method = {RequestMethod.PUT, RequestMethod.POST})
//    public Result<String> edit1(@RequestBody QcSsgqzysytdqk qcSsgqzysytdqk) {
//        //当输入的为亩时
//        if (qcSsgqzysytdqk.getSfsb() == 3) {
//            if (qcSsgqzysytdqk.getSjzytdmjdw().equals("1")) {
//                qcSsgqzysytdqk.setSjzytdmjGq(Zh.MzGq(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjPf(Zh.MzP(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjM(qcSsgqzysytdqk.getSjzytdmj());
//                qcSsgqzysytdqk.setQzpztdmjGq(Zh.MzGq(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjPf(Zh.MzP(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjM(qcSsgqzysytdqk.getQzpzsymj());
//            } else if (qcSsgqzysytdqk.getSjzytdmjdw().equals("2")) {//当输入的为公顷时
//                qcSsgqzysytdqk.setSjzytdmjPf(Zh.GqZp(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjM(Zh.GqZm(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjGq(qcSsgqzysytdqk.getSjzytdmj());
//                qcSsgqzysytdqk.setQzpztdmjPf(Zh.GqZp(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjM(Zh.GqZm(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjGq(qcSsgqzysytdqk.getQzpzsymj());
//            } else if (qcSsgqzysytdqk.getSjzytdmjdw().equals("3")) {//当输入的为平方米时
//                qcSsgqzysytdqk.setSjzytdmjM(Zh.PzM(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjGq(Zh.PzGq(qcSsgqzysytdqk.getSjzytdmj()));
//                qcSsgqzysytdqk.setSjzytdmjPf(qcSsgqzysytdqk.getSjzytdmj());
//                qcSsgqzysytdqk.setQzpztdmjM(Zh.PzM(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjGq(Zh.PzGq(qcSsgqzysytdqk.getQzpzsymj()));
//                qcSsgqzysytdqk.setQzpztdmjPf(qcSsgqzysytdqk.getQzpzsymj());
//            }
//            if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("1")) {//当输入的为亩时
//                qcSsgqzysytdqk.setSjsyjzmjGq(Zh.MzGq(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjPf(Zh.MzP(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjM(qcSsgqzysytdqk.getSjsyjzmj());
//                qcSsgqzysytdqk.setQzpzjzmjGq(Zh.MzGq(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjPf(Zh.MzP(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjM(qcSsgqzysytdqk.getQzpzsymj2());
//            } else if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("2")) {//当输入的为公顷时
//                qcSsgqzysytdqk.setSjsyjzmjM(Zh.GqZm(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjPf(Zh.GqZp(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjGq(qcSsgqzysytdqk.getSjsyjzmj());
//                qcSsgqzysytdqk.setQzpzjzmjM(Zh.GqZm(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjPf(Zh.GqZp(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjGq(qcSsgqzysytdqk.getQzpzsymj2());
//            } else if (qcSsgqzysytdqk.getSjsyjzmjdw().equals("3")) {//当输入的为平方米时
//                qcSsgqzysytdqk.setSjsyjzmjGq(Zh.PzGq(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjM(Zh.PzM(qcSsgqzysytdqk.getSjsyjzmj()));
//                qcSsgqzysytdqk.setSjsyjzmjPf(qcSsgqzysytdqk.getSjsyjzmj());
//                qcSsgqzysytdqk.setQzpzjzmjGq(Zh.PzGq(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjM(Zh.PzM(qcSsgqzysytdqk.getQzpzsymj2()));
//                qcSsgqzysytdqk.setQzpzjzmjPf(qcSsgqzysytdqk.getQzpzsymj2());
//            }
//            qcSsgqzysytdqk.setSfsb(1);
//            qcSsgqzysytdqkService.saveOrUpdate(qcSsgqzysytdqk);
//
//        }
//
//
//
//        return Result.OK("变更成功!");
//    }




//    /**
//     * 分页列表查询
//     *
//     * @param qcSsgqzysytdqk
//     * @param pageNo
//     * @param pageSize
//     * @param req
//     * @return
//     */
//    /**
//     * @AutoLog(value = "省属国企占有使用土地情况调查-分页列表查询")
//     */
//    @ApiOperation(value = "省属国企占有使用土地情况调查-分页列表查询", notes = "省属国企占有使用土地情况调查-分页列表查询")
//    @GetMapping(value = "/list")
//    @PermissionData(pageComponent = "qcsb/QcSsgqzysytdqkList")
//    public Result<IPage<QcSsgqzysytdqk>> queryPageList(QcSsgqzysytdqk qcSsgqzysytdqk,
//                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                       HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        List<Integer> sbzts = new ArrayList<>();
//        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        System.out.println(sysUser);
//        if ("gzw".equals(sysUser.getUsername())) {
//            queryWrapper.likeRight("sys_org_code", "A04");
//        }
//        queryWrapper.likeRight("sys_org_code", "A04");
//        //sbzts.add(0);
//        //sbzts.add(1);
//        //queryWrapper.in("sfsb",sbzts);
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }
//
//    @AutoLog(value = "用地单位信息是否上报")
//    @ApiOperation(value = "用地单位信息是否上报", notes = "用地单位信息是否上报")
//    @GetMapping(value = "/sfsb")
//    public Result<String> sfshz(String id) {
//        qcSsgqzysytdqkService.upSfsb(id);
//        return Result.OK("提交成功!");
//    }

//    /**
//     * 分页列表查询
//     *
//     * @param qcSsgqzysytdqk
//     * @param pageNo
//     * @param pageSize
//     * @param req
//     * @return
//     */
//    //@AutoLog(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询", notes = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
//    @GetMapping(value = "/list1")
//    public Result<IPage<QcSsgqzysytdqk>> queryPageList1(QcSsgqzysytdqk qcSsgqzysytdqk,
//                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                        HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        List<Integer> sbzts = new ArrayList<>();
//        sbzts.add(1);
//        sbzts.add(2);
//        queryWrapper.in("sfsb", sbzts);
//        if (qcSsgqzysytdqk.getShzt() != null) {
//            queryWrapper.eq("shzt", qcSsgqzysytdqk.getShzt());
//        }
//        queryWrapper.likeRight("sys_org_code", "A04");
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }

//    @ApiOperation(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询", notes = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
//    @GetMapping(value = "/listBygly")
//    public Result<IPage<QcSsgqzysytdqk>> queryPageListBygly(QcSsgqzysytdqk qcSsgqzysytdqk,String year,
//                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                            HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        queryWrapper.likeRight("sys_org_code", "A04");
//        queryWrapper.gt("sfsb", 0);
//        if (year!=null){
//            queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
//        }
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }
//    /**
//     * 分页列表查询
//     *
//     * @param qcSsgqzysytdqk
//     * @param pageNo
//     * @param pageSize
//     * @param req
//     * @return
//     */
//    //@AutoLog(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询", notes = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
//    @GetMapping(value = "/list2")
//    public Result<IPage<QcSsgqzysytdqk>> queryPageList2(QcSsgqzysytdqk qcSsgqzysytdqk,String year,
//                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                        HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        List<Integer> sbzts = new ArrayList<>();
//        sbzts.add(3);
//        sbzts.add(4);
//        queryWrapper.in("sfsb", sbzts);
//        queryWrapper.likeRight("sys_org_code", "A04");
//        if (year!=null){
//            queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
//        }
//        if (qcSsgqzysytdqk.getShzt() != null) {
//            queryWrapper.eq("shzt", qcSsgqzysytdqk.getShzt());
//        }
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }

//    /**
//     * 分页列表查询
//     *
//     * @param qcSsgqzysytdqk
//     * @param pageNo
//     * @param pageSize
//     * @param req
//     * @return
//     */
//    //@AutoLog(value = "省属国企占有使用土地情况调查-审核错误退回分页列表查询")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-审核错误退回分页列表查询", notes = "省属国企占有使用土地情况调查-审核错误退回分页列表查询")
//    @GetMapping(value = "/list4")
//    @PermissionData(pageComponent = "qcsb/QcSsgqzysytdqkList4")
//    public Result<IPage<QcSsgqzysytdqk>> queryPageList4(QcSsgqzysytdqk qcSsgqzysytdqk,
//                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                        HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        queryWrapper.eq("sfsb", 4);
//        queryWrapper.likeRight("sys_org_code", "A04");
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }

//    /**
//     * 分页列表查询
//     *
//     * @param qcSsgqzysytdqk
//     * @param pageNo
//     * @param pageSize
//     * @param req
//     * @return
//     */
//    //@AutoLog(value = "省属国企占有使用土地情况调查-分页列表查询")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-分页列表查询", notes = "机关事业单位占有使用土地情况调查-分页列表查询")
//    @GetMapping(value = "/list5")
//    @PermissionData(pageComponent = "sydwqcsb/QcSsgqzysytdqkList")
//    public Result<IPage<QcSsgqzysytdqk>> queryPageList5(QcSsgqzysytdqk qcSsgqzysytdqk,
//                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                        HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        List<Integer> sbzts = new ArrayList<>();
//        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//        queryWrapper.likeRight("sys_org_code", "A03");
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }

//    /**
//     * 分页列表查询
//     *
//     * @param qcSsgqzysytdqk
//     * @param pageNo
//     * @param pageSize
//     * @param req
//     * @return
//     */
//    //@AutoLog(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-已上报待审核分页列表查询", notes = "省属国企占有使用土地情况调查-已上报待审核分页列表查询")
//    @GetMapping(value = "/list6")
//    public Result<IPage<QcSsgqzysytdqk>> queryPageList6(QcSsgqzysytdqk qcSsgqzysytdqk,
//                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                        HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        List sbzts = new ArrayList<>();
//        sbzts.add(1);
//        sbzts.add(2);
//        queryWrapper.in("sfsb", sbzts);
//        queryWrapper.likeRight("sys_org_code", "A03");
//        if (qcSsgqzysytdqk.getShzt() != null) {
//            queryWrapper.eq("shzt", qcSsgqzysytdqk.getShzt());
//        }
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }

//    /**
//     * 分页列表查询
//     *
//     * @param qcSsgqzysytdqk
//     * @param pageNo
//     * @param pageSize
//     * @param req
//     * @return
//     */
//    //@AutoLog(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询", notes = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
//    @GetMapping(value = "/list7")
//    public Result<IPage<QcSsgqzysytdqk>> queryPageList7(QcSsgqzysytdqk qcSsgqzysytdqk,String year,
//                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                        HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        List<Integer> sbzts = new ArrayList<>();
//        sbzts.add(3);
//        sbzts.add(4);
//        queryWrapper.in("sfsb", sbzts);
//        queryWrapper.likeRight("sys_org_code", "A03");
//        if (year!=null){
//            queryWrapper.apply("TO_CHAR(create_time, 'YYYY') LIKE {0}", year + "%");
//        }
//        if (qcSsgqzysytdqk.getShzt() != null) {
//            queryWrapper.eq("shzt", qcSsgqzysytdqk.getShzt());
//        }
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }

//    /**
//     * 分页列表查询
//     *
//     * @param qcSsgqzysytdqk
//     * @param pageNo
//     * @param pageSize
//     * @param req
//     * @return
//     */
//    //@AutoLog(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
//    @ApiOperation(value = "省属国企占有使用土地情况调查-所有已经审核分页列表查询", notes = "省属国企占有使用土地情况调查-所有已经审核分页列表查询")
//    @GetMapping(value = "/list9")
//    @PermissionData(pageComponent = "sydwqcsb/QcSsgqzysytdqkList4")
//
//    public Result<IPage<QcSsgqzysytdqk>> queryPageList9(QcSsgqzysytdqk qcSsgqzysytdqk,
//                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
//                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
//                                                        HttpServletRequest req) {
//        QueryWrapper<QcSsgqzysytdqk> queryWrapper = QueryGenerator.initQueryWrapper(qcSsgqzysytdqk, req.getParameterMap());
//        Page<QcSsgqzysytdqk> page = new Page<QcSsgqzysytdqk>(pageNo, pageSize);
//        List<Integer> sbzts = new ArrayList<>();
//        sbzts.add(4);
//        queryWrapper.in("sfsb", sbzts);
//        queryWrapper.likeRight("sys_org_code", "A03");
//        IPage<QcSsgqzysytdqk> pageList = qcSsgqzysytdqkService.page(page, queryWrapper);
//        return Result.OK(pageList);
//    }


	/* *//**
	 * 导入shp数据
	 *
	 * @param request
	 * @param response
	 * @return
	 *//*
    @RequestMapping(value = "/importDkxxExcel/{id}")
    @Transactional(rollbackFor = {Exception.class})
    public Result<?> importDkxxExcel(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") String id) throws IOException {
        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
        Result<QcSsgqzysytdqk> gdXmResult = queryById(id);
        String dkmc = gdXmResult.getResult().getDk();
        System.out.println(dkmc);
        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
            // 获取上传文件对象
            MultipartFile file = entity.getValue();
            System.out.println(file.getContentType());
            if (file.getContentType().equals("text/plain")) {
                GisUtil zh = new GisUtil();
                HashMap<String, Object> map = new HashMap<String, Object>();
                String dkid = UUID.randomUUID().toString().replaceAll("-", "");
                int i1 = (int) (Math.random() * 100 + 1);
               *//* String dkmc = "地块" + i1;*//*
                List list = new ArrayList();
                List Zblist = new ArrayList();
                List result=new ArrayList();
                String encoding = "GBK";
                try {
                    InputStreamReader inputStream = new InputStreamReader(file.getInputStream(), encoding);
                    BufferedReader bufferedReader = new BufferedReader(inputStream);
                    String strTmp = "";
                    while ((strTmp = bufferedReader.readLine()) != null) {
                        list.add(strTmp);
                    }
                    for (int i = 0; i < list.size(); i++) {
                        if (list.get(i).toString().contains("@")) {
                            for (int j = i + 1; j < list.size(); j++) {
                                Zblist.add(list.get(j));
                            }
                        }
                    }
                    String s2="1";
                    System.out.println(Zblist);
                    ArrayList<Integer> ordinate =new ArrayList<>();
                    for (int i = 0; i < Zblist.size(); i++) {
                        String[] split = String.valueOf(Zblist.get(i)).split(",");
                        for (int j = 0; j + 4 <= split.length; j = j + 4) {
                            String s = zh.coordinateTransform(Double.valueOf(split[j + 2]), Double.valueOf(split[j + 3]), 117);
                            String[] zb = s.split(",");
                            for (String s1 : zb) {
                                result.add(s1);
                            }
                            if(!split[j+1].equals(s2)){
                                ordinate.add(i*2+1);//判断圈号开始的位置
                            }
                            s2=split[j+1];//标记位
                        }
                    }
                    //组合sdo_elem_info_array
                    StringBuilder recod =new StringBuilder();
                    recod.append("1,1003,1");
                    if(!s2.equals("1")){
                        for (int i = 0; i <ordinate.size() ; i++) {
                            recod.append(","+ordinate.get(i).toString()+",2003,1");
                        }
                    }
                    System.out.println(recod);
                    //判断单个地块首尾是否闭合
                    for (int i = 0; i <result.size() ; i++) {
                        String jd = result.get(0).toString();
                        String wd =result.get(1).toString();
                        if(!result.get(result.size()-1).equals(wd) && s2.equals("1")){
                            result.add(jd);
                            result.add(wd);
                        }
                    }
                   *//* HashMap map1=new HashMap();
                    map1.put("shape",result);
                    List<Object> repeatedland = gdDkxxService.Repeatedland(map1);
                    if(repeatedland.size()>0){
                        System.out.println(repeatedland);
                        return Result.error("重复供地");
                    }*//*
                    System.out.println(result);
                    map.put("id",dkid);
                   *//* map.put("dz_ba_bh",gdXmResult.getResult().getDzBaBh());*//*
                    map.put("dkmc", dkmc);
                    map.put("xmid", id);
                   *//* map.put("xmmc", xmmc);;*//*
                    map.put("shape", result);
                    map.put("area",result);
                    map.put("recod", Arrays.asList(recod.toString().split(",")));
                    qcSsgqzysytdqkService.insertDkxx(map);
                   *//* gdDkxxService.getwkt(dkid);*//*
	 *//*gdDkxxService.insertDkxxFx(id);*//*
	 *//* gdDkxxService.UpdateSt(id);*//*
                    return Result.OK("文件导入成功");
                } catch (Exception E) {
                    log.error(E.getMessage(), E);
                    return Result.error("文件导入失败:" + E.getMessage());
                }

            } else if (file.getContentType().equals("application/vnd.ms-excel")) {
                int i1 = (int) (Math.random() * 100 + 1);
                *//*String dkmc = "地块" + i1;*//*
                String dkid = UUID.randomUUID().toString().replaceAll("-", "");
                ImportParams params = new ImportParams();
                params.setTitleRows(0);
                params.setHeadRows(1);
                params.setNeedSave(true);
                ArrayList<Integer> ordinate =new ArrayList<>();
                String s2="1";
                try {
                    GisUtil zh=new GisUtil();
                    HashMap<String, Object> map = new HashMap<String, Object>();
                    ArrayList<String> arr=new ArrayList<>();
                    List<excleTable> list = ExcelImportUtil.importExcel(file.getInputStream(), excleTable.class, params);
                    for (int i = 0; i < list.size() ; i++)
                    {
                        String zb = zh.coordinateTransform(list.get(i).getXcoord(), list.get(i).getYcoord(),117);
                        String[] split = zb.split(",");
                        for (int j = 0; j <split.length ; j++) {
                            arr.add(split[j]);
                        }
                        if(!list.get(i).getQh().equals(s2)){
                            ordinate.add(i*2+1);//判断圈号开始的位置
                        }
                        s2=list.get(i).getQh();//标记位

                    }
                    StringBuilder recod =new StringBuilder(); //创建recod用来存储sdo_elem_info_array();
                    recod.append("1,1003,1");
                    if(!s2.equals("1")){
                        for (int i = 0; i <ordinate.size() ; i++) {
                            recod.append(","+ordinate.get(i).toString()+",2003,1");
                        }
                    }
                    //判断单个地块首尾是否闭合
                    for (int i = 0; i <arr.size() ; i++) {
                        String jd = arr.get(0).toString();
                        String wd =arr.get(1).toString();
                        if(!arr.get(arr.size()-1).equals(wd) && s2.equals("1")){
                            arr.add(jd);
                            arr.add(wd);
                        }
                    }
                   *//* HashMap map1=new HashMap();
                    map1.put("shape",arr);
                    List<Object> repeatedland = gdDkxxService.Repeatedland(map1);
                    if(repeatedland.size()>0){
                        System.out.println(repeatedland);
                        return Result.error("重复供地");
                    }*//*
                    map.put("id",dkid);
                   *//* map.put("dz_ba_bh",gdXmResult.getResult().getDzBaBh());*//*
                    map.put("dkmc", dkmc);
                    map.put("xmid", id);
                   *//* map.put("xmmc", xmmc);*//*
                    map.put("shape", arr);
                    map.put("area",arr);
                    map.put("recod",Arrays.asList(recod.toString().split(",")));
                    System.out.println(Arrays.asList(recod.toString().split(",")));
                    qcSsgqzysytdqkService.insertDkxx(map);
                   *//* gdDkxxService.getwkt(dkid);
                    gdDkxxService.insertDkxxFx(id);
                    gdDkxxService.UpdateSt(id);*//*
                    return Result.OK("EXCEL文件导入成功！");
                } catch (Exception e) {
                    log.error(e.getMessage(), e);
                    return Result.error("文件导入失败:" + e.getMessage());
                } finally {
                    try {
                        file.getInputStream().close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            } else if (file.getContentType().equals("application/x-zip-compressed")) {
                String fileSavePath = uploadLocal(file, "shpPath");
                try {
                    //1、解压上传的zip文件
                    String upFileName = fileSavePath.substring(fileSavePath.lastIndexOf("/") + 1);
                    System.out.println(upFileName);
                    String fileNameNoExt = upFileName.substring(0, upFileName.lastIndexOf('.'));
                    String unZipPath = upLoadPath + "/shpPath/" + fileNameNoExt;
                    ZipAndRarTools.unZip(fileSavePath, unZipPath);
                    //2、获取shp文件及坐标系文件的路径
                    String shpfilepath = "";
                    File shpdir = new File(unZipPath);
                    File[] files = shpdir.listFiles();
                    for (int i = 0; i < files.length; i++) {
                        File shpFile = files[i];
                        String fileName = shpFile.getName();
                        if (fileName.endsWith(".shp")) {
                            shpfilepath = unZipPath + "/" + fileName;
                            continue;
                        }
                    }
                    List<Map<String, Object>> maps = readShpFile(shpfilepath);
                    List list = new ArrayList();
                    for (Map<String, Object> map : maps) {
                        for (String s : map.keySet()) {
                            if (s.equals("the_geom")) {
                                list.add(map.get("the_geom").toString());
                            }
                        }
                    }
                    System.out.println(list);
                    for (int i = 0; i < list.size(); i++) {
                        String dkid = UUID.randomUUID().toString().replaceAll("-", "");
                        int i1 = (int) (Math.random() * 100 + 1);
                        *//*String dkmc = "地块" + i1;*//*
                        HashMap<String, Object> map = new HashMap<String, Object>();
                        int j = list.get(i).toString().lastIndexOf("(");
                        String substring = list.get(i).toString().substring(j + 1, (list.get(i).toString().length() - 3));
                        String replace = substring.replace(",", "");
                        String result = replace.replace(" ", ",");
                        String[] split1 = result.split(",");
                        StringBuilder recod =new StringBuilder(); //创建recod用来存储sdo_elem_info_array();
                        recod.append("1,1003,1");
                        map.put("id",dkid);
                        map.put("dkmc", dkmc);
                       *//* map.put("dzBaBh",gdXmResult.getResult().getDzBaBh());*//*
                        map.put("xmid", id);
                       *//* map.put("xmmc", xmmc);*//*
                        map.put("shape", Arrays.asList(split1));
                        map.put("area",Arrays.asList(split1));
                        map.put("recod",Arrays.asList(recod.toString().split(",")));
                        System.out.println(map);
                        qcSsgqzysytdqkService.insertDkxx(map);
                       *//* gdDkxxService.getwkt(dkid);*//*
	 *//* gdDkxxService.insertDkxxFx(id);*//*
	 *//* gdDkxxService.UpdateSt(id);*//*
	 *//*String wkt = zdDkxxbService.SelectLocation(dkid);//wkt*//*
                    }
                    return Result.OK("zip压缩包导入成功");
                } catch (Exception E) {
                    log.error(E.getMessage(), E);
                    return Result.error("文件导入失败:" + E.getMessage());
                }
            }
        }
        return Result.error("文件导入失败！");

    }
    *//**
	 * 读取shp文件属性
	 *
	 * @param shapePath
	 * @return
	 *//*
    public static List<Map<String, Object>> readShpFile(String shapePath) {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        ShapefileDataStoreFactory factory = new ShapefileDataStoreFactory();
        ShapefileDataStore dataStore = null;
        try {
            dataStore = (ShapefileDataStore) factory.createDataStore(new File(shapePath).toURI().toURL());
            if (dataStore != null) {
//                dataStore.setCharset(Charset.forName("UTF-8"));
                dataStore.setCharset(ShpCharset.GBK);
            }
            SimpleFeatureSource featureSource = dataStore.getFeatureSource();
            SimpleFeatureIterator itertor = featureSource.getFeatures().features();
            while (itertor.hasNext()) {
                SimpleFeature feature = itertor.next();
                Iterator<Property> itprop = feature.getProperties().iterator();
                Map<String, Object> map = new HashMap<String, Object>();
                while (itprop.hasNext()) {
                    Property prop = itprop.next();
                    map.put(String.valueOf(prop.getName()), String.valueOf(prop.getValue()));
                }
                list.add(map);
            }
            itertor.close();
        } catch (Exception e) {
            log.error("解析shp异常：", e.getMessage());
        } finally {
            if (dataStore != null) {
                dataStore.dispose();
            }
        }
        return list;
    }

    *//**
	 * 本地文件上传
	 *
	 * @param mf      文件
	 * @param bizPath 自定义路径
	 * @return
	 *//*
    private String uploadLocal(MultipartFile mf, String bizPath) {
        try {
            String ctxPath = upLoadPath;
            String fileName = null;
            File file = new File(ctxPath + File.separator + bizPath + File.separator);
            if (!file.exists()) {
                file.mkdirs();// 创建文件根目录
            }
            String orgName = mf.getOriginalFilename();// 获取文件名
            orgName = CommonUtils.getFileName(orgName);
            if (orgName.indexOf(".") != -1) {
                fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
            } else {
                fileName = orgName + "_" + System.currentTimeMillis();
            }
            String savePath = file.getPath() + File.separator + fileName;
            File savefile = new File(savePath);
            FileCopyUtils.copy(mf.getBytes(), savefile);
            if (savePath.contains("\\")) {
                savePath = savePath.replace("\\", "/");
            }
            return savePath;
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
        return "";
    }*/

}
