1194 lines
46 KiB
Java
1194 lines
46 KiB
Java
|
|
package com.rzyc.controller;
|
|||
|
|
|
|||
|
|
import com.alibaba.fastjson.JSON;
|
|||
|
|
import com.alibaba.fastjson.JSONArray;
|
|||
|
|
import com.common.utils.*;
|
|||
|
|
import com.common.utils.excel.ExcelUtils;
|
|||
|
|
import com.common.utils.model.*;
|
|||
|
|
import com.github.pagehelper.Page;
|
|||
|
|
import com.github.pagehelper.PageHelper;
|
|||
|
|
import com.rzyc.advice.LoginAuth;
|
|||
|
|
import com.rzyc.bean.ent.*;
|
|||
|
|
import com.rzyc.bean.setting.AreaPageDto;
|
|||
|
|
import com.rzyc.bean.setting.ChangeAreaDto;
|
|||
|
|
import com.rzyc.bean.user.*;
|
|||
|
|
import com.rzyc.bean.user.dto.UnitAuthChangeDto;
|
|||
|
|
import com.rzyc.enums.AreaLevel;
|
|||
|
|
import com.rzyc.model.SysDocumenttemp;
|
|||
|
|
import com.rzyc.model.SysOrg;
|
|||
|
|
import com.rzyc.model.user.SysAuth;
|
|||
|
|
import com.rzyc.model.user.SysUnitRole;
|
|||
|
|
import com.rzyc.model.user.SysUser;
|
|||
|
|
import io.swagger.annotations.Api;
|
|||
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|||
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|||
|
|
import io.swagger.annotations.ApiOperation;
|
|||
|
|
import org.apache.commons.beanutils.BeanUtils;
|
|||
|
|
import org.springframework.stereotype.Controller;
|
|||
|
|
import org.springframework.validation.annotation.Validated;
|
|||
|
|
import org.springframework.web.bind.annotation.*;
|
|||
|
|
|
|||
|
|
import javax.servlet.http.HttpServletResponse;
|
|||
|
|
import javax.validation.Valid;
|
|||
|
|
import java.util.*;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 系统设置
|
|||
|
|
*/
|
|||
|
|
@Api(tags = "系统设置")
|
|||
|
|
@CrossOrigin("*")
|
|||
|
|
@RequestMapping("setting")
|
|||
|
|
@Controller
|
|||
|
|
@Validated
|
|||
|
|
public class SettingController extends BaseController{
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 部门账号创建、登录情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "部门账号创建、登录情况", notes = "部门账号创建、登录情况")
|
|||
|
|
@PostMapping("/deptLoginData")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<UnitLoginData>> deptLoginData(@Validated UnitLoginDataDto unitLoginDataDto)throws Exception{
|
|||
|
|
SingleResult<Pager<UnitLoginData>> result = new SingleResult<>();
|
|||
|
|
//部门
|
|||
|
|
String unitId = DEPT_UNIT_ID;
|
|||
|
|
PageHelper.startPage(unitLoginDataDto.getPage(), unitLoginDataDto.getPageSize());
|
|||
|
|
Page<UnitLoginData> page = (Page<UnitLoginData>)sysUnitMapper.loginData(unitId);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<UnitLoginData> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleUnit(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出部门账号创建、登录情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出部门账号创建、登录情况", notes = "导出部门账号创建、登录情况")
|
|||
|
|
@GetMapping("exportDept")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportDept(HttpServletResponse response)throws Exception{
|
|||
|
|
//部门
|
|||
|
|
String unitId = DEPT_UNIT_ID;
|
|||
|
|
List<UnitLoginData> unitLoginData = sysUnitMapper.loginData(unitId);
|
|||
|
|
if(unitLoginData.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleUnit(unitLoginData);
|
|||
|
|
|
|||
|
|
String excelName = "部门登录信息"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,unitLoginData, UnitLoginData.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 处理平均数
|
|||
|
|
* @param units
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
private void handleUnit(List<UnitLoginData> units)throws Exception{
|
|||
|
|
for(UnitLoginData sysUnit : units){
|
|||
|
|
Integer avg = 0;
|
|||
|
|
if(sysUnit.getUserNum() > 0 ){
|
|||
|
|
avg = sysUnit.getLoginNum() / sysUnit.getUserNum();
|
|||
|
|
}
|
|||
|
|
sysUnit.setAverageNum(avg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 镇街、产业功能区账号创建、登录情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "镇街、产业功能区账号创建、登录情况", notes = "镇街、产业功能区账号创建、登录情况")
|
|||
|
|
@PostMapping("/streetLoginData")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<UnitLoginData>> streetLoginData(@Validated UnitLoginDataDto unitLoginDataDto)throws Exception{
|
|||
|
|
SingleResult<Pager<UnitLoginData>> result = new SingleResult<>();
|
|||
|
|
//部门
|
|||
|
|
String unitId = STREET_UNIT_ID;
|
|||
|
|
PageHelper.startPage(unitLoginDataDto.getPage(), unitLoginDataDto.getPageSize());
|
|||
|
|
Page<UnitLoginData> page = (Page<UnitLoginData>)sysUnitMapper.loginData(unitId);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<UnitLoginData> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleUnit(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出镇街、产业功能区账号创建、登录情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出镇街、产业功能区账号创建、登录情况", notes = "导出镇街、产业功能区账号创建、登录情况")
|
|||
|
|
@GetMapping("exportStreet")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportStreet(HttpServletResponse response)throws Exception{
|
|||
|
|
//部门
|
|||
|
|
String unitId = STREET_UNIT_ID;
|
|||
|
|
List<UnitLoginData> unitLoginData = sysUnitMapper.loginData(unitId);
|
|||
|
|
if(unitLoginData.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleUnit(unitLoginData);
|
|||
|
|
|
|||
|
|
String excelName = "镇街、产业功能区登录信息"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,unitLoginData, UnitLoginData.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 单位清单录入情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "单位清单录入情况", notes = "单位清单录入情况")
|
|||
|
|
@PostMapping("/listUserNum")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<PerformNum>> listUserNum(@Validated UnitLoginDataDto unitLoginDataDto)throws Exception{
|
|||
|
|
SingleResult<Pager<PerformNum>> result = new SingleResult<>();
|
|||
|
|
//部门
|
|||
|
|
PageHelper.startPage(unitLoginDataDto.getPage(), unitLoginDataDto.getPageSize());
|
|||
|
|
Page<PerformNum> page = (Page<PerformNum>)listPerformMapper.listUserNum();
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<PerformNum> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleListNum(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 计算清单录入情况
|
|||
|
|
* @param performNums
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
private void handleListNum(List<PerformNum> performNums)throws Exception{
|
|||
|
|
for(PerformNum performNum : performNums){
|
|||
|
|
Integer notListUserNum = performNum.getUserNum() - performNum.getListUserNum();
|
|||
|
|
performNum.setNotListUserNum(notListUserNum);
|
|||
|
|
|
|||
|
|
Double proportion = 0.0;
|
|||
|
|
if(null != performNum.getUserNum() && performNum.getUserNum() > 0){
|
|||
|
|
proportion = Arith.div(performNum.getListUserNum(),performNum.getUserNum(),2);
|
|||
|
|
proportion = proportion * 100;
|
|||
|
|
proportion = TypeConversion.decimalFormat(proportion,2);
|
|||
|
|
performNum.setProportion(proportion);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出单位清单录入情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出单位清单录入情况", notes = "导出单位清单录入情况")
|
|||
|
|
@GetMapping("exportList")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportList(HttpServletResponse response)throws Exception{
|
|||
|
|
List<PerformNum> performNums = listPerformMapper.listUserNum();
|
|||
|
|
if(performNums.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleListNum(performNums);
|
|||
|
|
|
|||
|
|
String excelName = "单位清单录入情况"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,performNums, PerformNum.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 部门履职记录录入情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "部门履职记录录入情况", notes = "部门履职记录录入情况")
|
|||
|
|
@PostMapping("/deptRecordNum")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<PerformRecord>> deptRecordNum(@Validated UnitLoginDataDto unitLoginDataDto)throws Exception{
|
|||
|
|
SingleResult<Pager<PerformRecord>> result = new SingleResult<>();
|
|||
|
|
|
|||
|
|
String year = Calendar.getInstance().get(Calendar.YEAR)+"";
|
|||
|
|
|
|||
|
|
//部门
|
|||
|
|
PageHelper.startPage(unitLoginDataDto.getPage(), unitLoginDataDto.getPageSize());
|
|||
|
|
Page<PerformRecord> page = (Page<PerformRecord>)listPerformMapper.performRecord(DEPT_RECORD_ID,year);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<PerformRecord> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleRecordNum(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出部门履职记录录入情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出部门履职记录录入情况", notes = "导出部门履职记录录入情况")
|
|||
|
|
@GetMapping("exportDeptRecord")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportDeptRecord(String year,HttpServletResponse response)throws Exception{
|
|||
|
|
|
|||
|
|
|
|||
|
|
if(StringUtils.isBlank(year)){
|
|||
|
|
year = Calendar.getInstance().get(Calendar.YEAR)+"";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
List<PerformRecord> performNums = listPerformMapper.performRecord(DEPT_RECORD_ID,year);
|
|||
|
|
if(performNums.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleRecordNum(performNums);
|
|||
|
|
|
|||
|
|
String excelName = "部门履职记录录入情况"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,performNums, PerformRecord.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 计算清单录入情况
|
|||
|
|
* @param performNums
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
private void handleRecordNum(List<PerformRecord> performNums)throws Exception{
|
|||
|
|
for(PerformRecord performNum : performNums){
|
|||
|
|
Integer notListUserNum = performNum.getUserNum() - performNum.getListUserNum();
|
|||
|
|
performNum.setNotListUserNum(notListUserNum);
|
|||
|
|
|
|||
|
|
Double proportion = 0.0;
|
|||
|
|
if(null != performNum.getUserNum() && performNum.getUserNum() > 0){
|
|||
|
|
proportion = Arith.div(performNum.getListUserNum(),performNum.getUserNum(),2);
|
|||
|
|
proportion = proportion * 100;
|
|||
|
|
proportion = TypeConversion.decimalFormat(proportion,2);
|
|||
|
|
performNum.setProportion(proportion);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 镇街履职记录录入情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "镇街履职记录录入情况", notes = "镇街履职记录录入情况")
|
|||
|
|
@PostMapping("/streetRecordNum")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<PerformRecord>> streetRecordNum(@Validated UnitLoginDataDto unitLoginDataDto)throws Exception{
|
|||
|
|
SingleResult<Pager<PerformRecord>> result = new SingleResult<>();
|
|||
|
|
String year = Calendar.getInstance().get(Calendar.YEAR)+"";
|
|||
|
|
//部门
|
|||
|
|
PageHelper.startPage(unitLoginDataDto.getPage(), unitLoginDataDto.getPageSize());
|
|||
|
|
Page<PerformRecord> page = (Page<PerformRecord>)listPerformMapper.performRecord(STREET_RECORD_ID,year);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<PerformRecord> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleRecordNum(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出镇街履职记录录入情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出镇街履职记录录入情况", notes = "导出镇街履职记录录入情况")
|
|||
|
|
@GetMapping("exportStreetRecord")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportStreetRecord(String year,HttpServletResponse response)throws Exception{
|
|||
|
|
|
|||
|
|
|
|||
|
|
if(StringUtils.isBlank(year)){
|
|||
|
|
year = Calendar.getInstance().get(Calendar.YEAR)+"";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
List<PerformRecord> performNums = listPerformMapper.performRecord(STREET_RECORD_ID,year);
|
|||
|
|
if(performNums.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleRecordNum(performNums);
|
|||
|
|
|
|||
|
|
String excelName = "镇街履职记录录入情况"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,performNums, PerformRecord.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 部门检查情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "部门检查情况", notes = "部门检查情况")
|
|||
|
|
@PostMapping("/unitCheck")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<UnitCheck>> unitCheck(@Valid UnitCheckDto unitCheckDto)throws Exception{
|
|||
|
|
SingleResult<Pager<UnitCheck>> result = new SingleResult<>();
|
|||
|
|
unitCheckDto.setStartTime(DateUtils.getHandleTime(unitCheckDto.getStartTime(),1));
|
|||
|
|
unitCheckDto.setEndTime(DateUtils.getHandleTime(unitCheckDto.getEndTime(),2));
|
|||
|
|
PageHelper.startPage(unitCheckDto.getPage(), unitCheckDto.getPageSize());
|
|||
|
|
Page<UnitCheck> page = (Page<UnitCheck>)sysUnitMapper.unitCheck(DEPT_UNIT_ID,unitCheckDto.getStartTime(),unitCheckDto.getEndTime());
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<UnitCheck> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleUnitCkeck(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出部门检查情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出部门检查情况", notes = "导出部门检查情况")
|
|||
|
|
@ApiImplicitParams({
|
|||
|
|
@ApiImplicitParam(name = "startTime",value = "开始时间 yyyy-MM-dd"),
|
|||
|
|
@ApiImplicitParam(name = "endTime",value = "结束时间 yyyy-MM-dd")
|
|||
|
|
})
|
|||
|
|
@GetMapping("exportUnitCheck")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportUnitCheck(HttpServletResponse response,String startTime,String endTime)throws Exception{
|
|||
|
|
List<UnitCheck> unitChecks = sysUnitMapper.unitCheck(DEPT_UNIT_ID,startTime,endTime);
|
|||
|
|
if(unitChecks.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleUnitCkeck(unitChecks);
|
|||
|
|
|
|||
|
|
String excelName = "部门检查情况"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,unitChecks, UnitCheck.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 镇街检查情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "镇街检查情况", notes = "镇街检查情况")
|
|||
|
|
@PostMapping("/streetCheck")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<UnitCheck>> streetCheck(@Valid UnitCheckDto unitCheckDto)throws Exception{
|
|||
|
|
SingleResult<Pager<UnitCheck>> result = new SingleResult<>();
|
|||
|
|
unitCheckDto.setStartTime(DateUtils.getHandleTime(unitCheckDto.getStartTime(),1));
|
|||
|
|
unitCheckDto.setEndTime(DateUtils.getHandleTime(unitCheckDto.getEndTime(),2));
|
|||
|
|
PageHelper.startPage(unitCheckDto.getPage(), unitCheckDto.getPageSize());
|
|||
|
|
Page<UnitCheck> page = (Page<UnitCheck>)sysUnitMapper.unitCheck(STREET_UNIT_ID,unitCheckDto.getStartTime(),unitCheckDto.getEndTime());
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<UnitCheck> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleUnitCkeck(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出镇街检查情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出镇街检查情况", notes = "导出镇街检查情况")
|
|||
|
|
@ApiImplicitParams({
|
|||
|
|
@ApiImplicitParam(name = "startTime",value = "开始时间 yyyy-MM-dd"),
|
|||
|
|
@ApiImplicitParam(name = "endTime",value = "结束时间 yyyy-MM-dd")
|
|||
|
|
})
|
|||
|
|
@GetMapping("exportStreetCheck")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportStreetCheck(HttpServletResponse response,String startTime,String endTime)throws Exception{
|
|||
|
|
List<UnitCheck> unitChecks = sysUnitMapper.unitCheck(STREET_UNIT_ID,startTime,endTime);
|
|||
|
|
if(unitChecks.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleUnitCkeck(unitChecks);
|
|||
|
|
|
|||
|
|
String excelName = "部门检查情况"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,unitChecks, UnitCheck.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 处理数据
|
|||
|
|
* @param checks
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
private void handleUnitCkeck(List<UnitCheck> checks)throws Exception{
|
|||
|
|
for (UnitCheck check : checks){
|
|||
|
|
check.setCheckEnt(check.getCheckNum());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 企业组织架构建立情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "企业组织架构建立情况", notes = "企业组织架构建立情况")
|
|||
|
|
@PostMapping("/entBuild")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<EntBulid>> entBuild(@Valid EntBuildDto entBuildDto)throws Exception{
|
|||
|
|
SingleResult<Pager<EntBulid>> result = new SingleResult<>();
|
|||
|
|
PageHelper.startPage(entBuildDto.getPage(), entBuildDto.getPageSize());
|
|||
|
|
Page<EntBulid> page = (Page<EntBulid>)sysUnitMapper.entBuild(DEPT_UNIT_ID);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<EntBulid> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleEntBuild(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 数据处理
|
|||
|
|
* @param entBulids
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
private void handleEntBuild(List<EntBulid> entBulids)throws Exception{
|
|||
|
|
for (EntBulid entBulid : entBulids){
|
|||
|
|
Integer buildNum = entBulid.getEntUserNum() - entBulid.getNotBuildNum();
|
|||
|
|
entBulid.setBuildNum(buildNum);
|
|||
|
|
|
|||
|
|
Double proportion = 0.0;
|
|||
|
|
if(entBulid.getEntUserNum() > 0 ){
|
|||
|
|
proportion = Arith.div(entBulid.getBuildNum(),entBulid.getEntUserNum(),2);
|
|||
|
|
proportion = proportion*100;
|
|||
|
|
proportion = TypeConversion.decimalFormat(proportion,2);
|
|||
|
|
entBulid.setProportion(proportion);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出企业组织架构建立情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出企业组织架构建立情况", notes = "导出企业组织架构建立情况")
|
|||
|
|
@GetMapping("exportEntBuild")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportEntBuild(HttpServletResponse response)throws Exception{
|
|||
|
|
List<EntBulid> entBulids = sysUnitMapper.entBuild(DEPT_UNIT_ID);
|
|||
|
|
if(entBulids.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleEntBuild(entBulids);
|
|||
|
|
|
|||
|
|
String excelName = "企业组织架构建立情况"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,entBulids, EntBulid.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 企业清单录入情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "企业清单录入情况", notes = "企业清单录入情况")
|
|||
|
|
@PostMapping("/entList")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<EntList>> entList(@Valid EntBuildDto entBuildDto)throws Exception{
|
|||
|
|
SingleResult<Pager<EntList>> result = new SingleResult<>();
|
|||
|
|
PageHelper.startPage(entBuildDto.getPage(), entBuildDto.getPageSize());
|
|||
|
|
Page<EntList> page = (Page<EntList>)sysUnitMapper.entList(DEPT_UNIT_ID);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<EntList> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//处理数据
|
|||
|
|
handleEntList(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 数据处理
|
|||
|
|
* @param entLists
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
private void handleEntList(List<EntList> entLists)throws Exception{
|
|||
|
|
for (EntList entList : entLists){
|
|||
|
|
Integer listNum = entList.getEntUserNum() - entList.getNotListNum();
|
|||
|
|
entList.setListNum(listNum);
|
|||
|
|
|
|||
|
|
Double proportion = 0.0;
|
|||
|
|
if(entList.getEntUserNum() > 0 ){
|
|||
|
|
proportion = Arith.div(entList.getListNum(),entList.getEntUserNum(),2);
|
|||
|
|
proportion = proportion*100;
|
|||
|
|
proportion = TypeConversion.decimalFormat(proportion,2);
|
|||
|
|
entList.setProportion(proportion);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出企业清单录入情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出企业清单录入情况", notes = "导出企业清单录入情况")
|
|||
|
|
@GetMapping("exportEntList")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportEntList(HttpServletResponse response)throws Exception{
|
|||
|
|
List<EntList> entLists = sysUnitMapper.entList(DEPT_UNIT_ID);
|
|||
|
|
if(entLists.size() > 0){
|
|||
|
|
//处理数据
|
|||
|
|
handleEntList(entLists);
|
|||
|
|
|
|||
|
|
String excelName = "企业清单录入情况"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,entLists, EntList.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 企业清单录入详细情况
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "企业清单录入详细情况", notes = "企业清单录入详细情况")
|
|||
|
|
@PostMapping("/companyList")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<CompanyList>> companyList(@Valid CompanyListDto companyListDto)throws Exception{
|
|||
|
|
SingleResult<Pager<CompanyList>> result = new SingleResult<>();
|
|||
|
|
PageHelper.startPage(companyListDto.getPage(), companyListDto.getPageSize());
|
|||
|
|
String condition = TypeConversion.getCondition(companyListDto.getCondition());
|
|||
|
|
Page<CompanyList> page = (Page<CompanyList>)sysEnterpriseMapper.companyList(condition);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<CompanyList> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出企业清单录入详细情况
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出企业清单录入详细情况", notes = "导出企业清单录入详细情况")
|
|||
|
|
@ApiImplicitParam(name = "condition",value = "关键字")
|
|||
|
|
@GetMapping("exportCompanyList")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportCompanyList(HttpServletResponse response,String condition)throws Exception{
|
|||
|
|
condition = TypeConversion.getCondition(condition);
|
|||
|
|
List<CompanyList> entLists = sysEnterpriseMapper.companyList(condition);
|
|||
|
|
if(entLists.size() > 0){
|
|||
|
|
|
|||
|
|
String excelName = "企业清单录入情况"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,entLists, CompanyList.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 企业法人承诺
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "企业法人承诺", notes = "企业法人承诺")
|
|||
|
|
@PostMapping("/legalPromise")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<LegalPromise>> legalPromise(@Valid LegalPromiseDto legalPromiseDto)throws Exception{
|
|||
|
|
SingleResult<Pager<LegalPromise>> result = new SingleResult<>();
|
|||
|
|
PageHelper.startPage(legalPromiseDto.getPage(), legalPromiseDto.getPageSize());
|
|||
|
|
String condition = TypeConversion.getCondition(legalPromiseDto.getCondition());
|
|||
|
|
Page<LegalPromise> page = (Page<LegalPromise>)sysEnterpriseMapper.legalPromise(condition);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<LegalPromise> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出企业法人承诺
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出企业法人承诺", notes = "导出企业法人承诺")
|
|||
|
|
@ApiImplicitParam(name = "condition",value = "关键字")
|
|||
|
|
@GetMapping("exportLegalPromise")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportLegalPromise(HttpServletResponse response,String condition)throws Exception{
|
|||
|
|
condition = TypeConversion.getCondition(condition);
|
|||
|
|
List<LegalPromise> legalPromise = sysEnterpriseMapper.legalPromise(condition);
|
|||
|
|
if(legalPromise.size() > 0){
|
|||
|
|
|
|||
|
|
String excelName = "企业法人承诺"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,legalPromise, LegalPromise.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 岗位承诺
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@LoginAuth
|
|||
|
|
@ApiOperation(value = "岗位承诺", notes = "岗位承诺")
|
|||
|
|
@PostMapping("/postPromise")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<Pager<PostPromise>> postPromise(@Valid LegalPromiseDto legalPromiseDto)throws Exception{
|
|||
|
|
SingleResult<Pager<PostPromise>> result = new SingleResult<>();
|
|||
|
|
PageHelper.startPage(legalPromiseDto.getPage(), legalPromiseDto.getPageSize());
|
|||
|
|
String condition = TypeConversion.getCondition(legalPromiseDto.getCondition());
|
|||
|
|
Page<PostPromise> page = (Page<PostPromise>)sysEnterpriseMapper.postPromise(condition);
|
|||
|
|
if(page.getTotal() > 0){
|
|||
|
|
Pager<PostPromise> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
//岗位承诺处理
|
|||
|
|
handlePostPromise(pager.getRows());
|
|||
|
|
result.setData(pager);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 岗位承诺处理
|
|||
|
|
* @param postPromises
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
private void handlePostPromise(List<PostPromise> postPromises)throws Exception{
|
|||
|
|
for (PostPromise postPromise : postPromises){
|
|||
|
|
postPromise.setPromiseNum(postPromise.getEntUserNum()-postPromise.getNotPromiseNum());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 导出企业岗位承诺
|
|||
|
|
* @param response
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "导出企业岗位承诺", notes = "导出企业岗位承诺")
|
|||
|
|
@ApiImplicitParam(name = "condition",value = "关键字")
|
|||
|
|
@GetMapping("exportPostPromise")
|
|||
|
|
@ResponseBody
|
|||
|
|
public void exportPostPromise(HttpServletResponse response,String condition)throws Exception{
|
|||
|
|
condition = TypeConversion.getCondition(condition);
|
|||
|
|
List<PostPromise> postPromise = sysEnterpriseMapper.postPromise(condition);
|
|||
|
|
if(postPromise.size() > 0){
|
|||
|
|
handlePostPromise(postPromise);
|
|||
|
|
String excelName = "导出企业岗位承诺"+ DateUtils.getNowDateTimeStr("yyyyMMdd") +".xlsx";
|
|||
|
|
long t1 = System.currentTimeMillis();
|
|||
|
|
ExcelUtils.writeExcel(response, excelName,postPromise, PostPromise.class);
|
|||
|
|
long t2 = System.currentTimeMillis();
|
|||
|
|
System.out.println(String.format("write over! cost:%sms", (t2 - t1)));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 批量修改密码
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "修改密码", notes = "修改密码")
|
|||
|
|
@GetMapping("changePassword")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<String> changePassword()throws Exception{
|
|||
|
|
SingleResult<String> result = new SingleResult<>();
|
|||
|
|
List<SysUser> users = sysUserMapper.allGovUser();
|
|||
|
|
for (SysUser user : users){
|
|||
|
|
/*
|
|||
|
|
String password = "123456";
|
|||
|
|
String passwdStr = PasswdFactory.encryptPasswd(user.getSysuserid(), user.getSysusername(), password);
|
|||
|
|
if(passwdStr.equals(user.getSyspassword())){
|
|||
|
|
String nowPasswd = "xindu1018";
|
|||
|
|
String nowPasswordStr = PasswdFactory.encryptPasswd(user.getSysuserid(), user.getSysusername(), nowPasswd);
|
|||
|
|
System.out.println("nowPasswordStr -> "+user.getUsertype()+"-"+user.getSysusername());
|
|||
|
|
// sysUserMapper.changePassword(user.getSysuserid(),nowPasswordStr);
|
|||
|
|
}
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
// String nowPasswd = "xindu1018";
|
|||
|
|
// String nowPasswordStr = PasswdFactory.encryptPasswd(user.getSysuserid(), user.getSysusername(), nowPasswd);
|
|||
|
|
// System.out.println("nowPasswordStr -> "+user.getUsertype()+"-"+user.getSysusername());
|
|||
|
|
// sysUserMapper.changePassword(user.getSysuserid(),nowPasswordStr);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*List<SysEntUser> entUsers = sysEntUserMapper.findAll();
|
|||
|
|
if(entUsers.size() > 0 ){
|
|||
|
|
for (SysEntUser entUser : entUsers){
|
|||
|
|
String password = "123456";
|
|||
|
|
String passwdStr = PasswdFactory.encryptPasswd(entUser.getSysentuserid(), entUser.getName(), password);
|
|||
|
|
if(passwdStr.equals(entUser.getPassword())){
|
|||
|
|
String nowPasswd = "xindu1018";
|
|||
|
|
String nowPasswordStr = PasswdFactory.encryptPasswd(entUser.getSysentuserid(), entUser.getName(), nowPasswd);
|
|||
|
|
System.out.println("name -> "+entUser.getName());
|
|||
|
|
// sysEntUserMapper.changePassword(entUser.getSysentuserid(),nowPasswordStr);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}*/
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 地区分页
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "地区分页", notes = "地区分页")
|
|||
|
|
@GetMapping("areaPage")
|
|||
|
|
@ResponseBody
|
|||
|
|
@LoginAuth
|
|||
|
|
public SingleResult<Pager<SysOrg>> areaPage(@Valid AreaPageDto areaPageDto)throws Exception{
|
|||
|
|
SingleResult<Pager<SysOrg>> result = new SingleResult<>();
|
|||
|
|
String condition = TypeConversion.getCondition(areaPageDto.getCondition());
|
|||
|
|
//分页
|
|||
|
|
PageHelper.startPage(areaPageDto.getPage(), areaPageDto.getPageSize());
|
|||
|
|
Page<SysOrg> page = (Page<SysOrg>)sysOrgMapper.areaPage(condition,areaPageDto.getOrgcode());
|
|||
|
|
Pager<SysOrg> pager = new Pager<>();
|
|||
|
|
getDatePage(pager,page);
|
|||
|
|
result.setData(pager);
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 修改地区
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "修改地区", notes = "修改地区")
|
|||
|
|
@PostMapping("changeArea")
|
|||
|
|
@ResponseBody
|
|||
|
|
@LoginAuth
|
|||
|
|
public SingleResult<String> changeArea(@Valid ChangeAreaDto changeAreaDto)throws Exception{
|
|||
|
|
SingleResult<String> result = new SingleResult<>();
|
|||
|
|
SysOrg sysOrg = new SysOrg();
|
|||
|
|
BeanUtils.copyProperties(sysOrg,changeAreaDto);
|
|||
|
|
|
|||
|
|
//操作人
|
|||
|
|
String chinaName = getChinaName();
|
|||
|
|
sysOrg.setModifiedby(chinaName);
|
|||
|
|
sysOrg.setCreatedby(chinaName);
|
|||
|
|
sysOrg.setModifiedon(new Date());
|
|||
|
|
sysOrg.setCreatedon(new Date());
|
|||
|
|
|
|||
|
|
//计算东区等级
|
|||
|
|
if(StringUtils.isNotBlank(sysOrg.getSuperiororgcode())){
|
|||
|
|
SysOrg superOrg = sysOrgMapper.selectByPrimaryKey(sysOrg.getSuperiororgcode());
|
|||
|
|
if(null != superOrg){
|
|||
|
|
Integer orgLevel = superOrg.getOrglevel();
|
|||
|
|
orgLevel += 1;
|
|||
|
|
sysOrg.setOrglevel(orgLevel);
|
|||
|
|
}
|
|||
|
|
}else{
|
|||
|
|
sysOrg.setOrglevel(2);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if(StringUtils.isNotBlank(sysOrg.getOrgcode())){
|
|||
|
|
sysOrgMapper.changeArea(sysOrg);
|
|||
|
|
}else{
|
|||
|
|
sysOrg.setOrgcode(RandomNumber.getUUid());
|
|||
|
|
sysOrgMapper.insert(sysOrg);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 处理地区
|
|||
|
|
* @param userId
|
|||
|
|
* @param sysOrgs
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
public List<SysOrg> handleArea(String userId,List<SysOrg> sysOrgs)throws Exception{
|
|||
|
|
|
|||
|
|
//处理后的地区信息
|
|||
|
|
List<SysOrg> orgs = new ArrayList<>();
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
* 如果是天府新区账号 则能看到所有的地区
|
|||
|
|
* 如果是街道办账号则能看到街道办下的社区
|
|||
|
|
* 如果是社区 只能看到一个社区
|
|||
|
|
*/
|
|||
|
|
//获取用户地区id
|
|||
|
|
String areaCode = getUserArea(userId);
|
|||
|
|
if(StringUtils.isNotBlank(areaCode)){
|
|||
|
|
SysOrg userOrg = sysOrgMapper.selectByPrimaryKey(areaCode);
|
|||
|
|
if(null != userOrg){
|
|||
|
|
//用户不能为空 并且用户选择地区 则处理地区信息
|
|||
|
|
/**
|
|||
|
|
* 如果地区级别 为街道办
|
|||
|
|
* 则把地区等级为2 街道办id不等于用户的剔除 级别等于3 父级id不是本街道办的剔除
|
|||
|
|
*/
|
|||
|
|
if(AreaLevel.STREET.getLevel().equals(userOrg.getOrglevel())){
|
|||
|
|
//街道办级别
|
|||
|
|
for (SysOrg sysOrg : sysOrgs){
|
|||
|
|
if(AreaLevel.DISTRICT.getLevel().equals(sysOrg.getOrglevel())){
|
|||
|
|
//区级地区直接加如
|
|||
|
|
orgs.add(sysOrg);
|
|||
|
|
}else if(AreaLevel.STREET.getLevel().equals(sysOrg.getOrglevel())){
|
|||
|
|
//街道级别的区域 如果和用户区域相同 加入
|
|||
|
|
if(userOrg.getOrgcode().equals(sysOrg.getOrgcode())){
|
|||
|
|
orgs.add(sysOrg);
|
|||
|
|
}
|
|||
|
|
}else if(AreaLevel.COMMUNITY.getLevel().equals(sysOrg.getOrglevel())){
|
|||
|
|
//社区级别的区域 如果父级地区id和用户区域相同 加入
|
|||
|
|
if(userOrg.getOrgcode().equals(sysOrg.getSuperiororgcode())){
|
|||
|
|
orgs.add(sysOrg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}else if(AreaLevel.COMMUNITY.getLevel().equals(userOrg.getOrglevel())){
|
|||
|
|
//社区级别区域
|
|||
|
|
for (SysOrg sysOrg : sysOrgs){
|
|||
|
|
if(AreaLevel.STREET.getLevel().equals(sysOrg.getOrglevel())){
|
|||
|
|
/*
|
|||
|
|
街道级别的区域 如果和用户区域父级区域id相同 加入
|
|||
|
|
*/
|
|||
|
|
if(userOrg.getSuperiororgcode().equals(sysOrg.getOrgcode())){
|
|||
|
|
orgs.add(sysOrg);
|
|||
|
|
}
|
|||
|
|
}else if(AreaLevel.COMMUNITY.getLevel().equals(sysOrg.getOrglevel())){
|
|||
|
|
//社区级别的区域 如果和用户区域id相同 加入
|
|||
|
|
if(userOrg.getOrgcode().equals(sysOrg.getOrgcode())){
|
|||
|
|
orgs.add(sysOrg);
|
|||
|
|
}
|
|||
|
|
}else{
|
|||
|
|
orgs.add(sysOrg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}else{
|
|||
|
|
//如果是街道办账号 则返回所有所有地区信息
|
|||
|
|
orgs = sysOrgs;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return orgs;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 用户地区树形结构
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "用户地区树形结构", notes = "用户地区树形结构")
|
|||
|
|
@ApiImplicitParam(name = "userId",value = "用户id",required = true)
|
|||
|
|
@GetMapping("userAreaTree/{userId}")
|
|||
|
|
@ResponseBody
|
|||
|
|
public MultiResult<SysOrg> userAreaTree(@PathVariable String userId)throws Exception{
|
|||
|
|
//多条数据集合处理
|
|||
|
|
MultiResult<SysOrg> result = new MultiResult<>();
|
|||
|
|
//查找地区列表
|
|||
|
|
List<SysOrg> sysOrgs = sysOrgMapper.findAll();
|
|||
|
|
//处理地区
|
|||
|
|
sysOrgs = handleArea(userId,sysOrgs);
|
|||
|
|
if(sysOrgs.size() >0){
|
|||
|
|
//把处理好的地区放进树形结构中并以有序的值序列的形式返回
|
|||
|
|
JSONArray jsonArray = handleAreaTree(sysOrgs);
|
|||
|
|
List<SysOrg> areas = JSONArray.parseArray(jsonArray.toJSONString(),SysOrg.class);
|
|||
|
|
//将jsonArray.toJSONString(),参照SysOrg这个类,将json字符串转换成一个一个的实体类(因为json字符串中有很多数据,因此需要parseArray解析成数组),存入到list集合中去
|
|||
|
|
result.setData(areas);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 地区树形结构
|
|||
|
|
* @param sysOrgs
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
private JSONArray handleAreaTree(List<SysOrg> sysOrgs)throws Exception{
|
|||
|
|
//以map的形式存储集合
|
|||
|
|
List<Map<String,Object>> data = new ArrayList<>();
|
|||
|
|
//遍历地区列表
|
|||
|
|
for(SysOrg sysOrg : sysOrgs){
|
|||
|
|
if(StringUtils.isBlank(sysOrg.getSuperiororgcode())){
|
|||
|
|
sysOrg.setSuperiororgcode("");
|
|||
|
|
}
|
|||
|
|
//将地区编码、地区名、地区等级、父级地区id存进集合
|
|||
|
|
Map<String,Object> entUserMap = new HashMap<String,Object>();
|
|||
|
|
entUserMap.put("orgcode",sysOrg.getOrgcode());
|
|||
|
|
entUserMap.put("orgname",sysOrg.getOrgname());
|
|||
|
|
entUserMap.put("orglevel",sysOrg.getOrglevel());
|
|||
|
|
entUserMap.put("superiororgcode",sysOrg.getSuperiororgcode());
|
|||
|
|
data.add(entUserMap);
|
|||
|
|
}
|
|||
|
|
//转为树状结构
|
|||
|
|
JSONArray result = TypeConversion.listToTree(JSONArray.parseArray(JSON.toJSONString(data)),"orgcode","superiororgcode","children");
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 用户下级地区
|
|||
|
|
* @return
|
|||
|
|
* @throws Exception
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "用户下级地区", notes = "用户下级地区")
|
|||
|
|
@GetMapping("userArea/{userId}")
|
|||
|
|
@ResponseBody
|
|||
|
|
public MultiResult<SysOrg> userArea(@PathVariable String userId)throws Exception{
|
|||
|
|
MultiResult<SysOrg> result = new MultiResult<>();
|
|||
|
|
|
|||
|
|
String areaCode = getUserArea(userId);
|
|||
|
|
List<SysOrg> sysOrgs = sysOrgMapper.findByParentId(areaCode);
|
|||
|
|
if(null != sysOrgs && sysOrgs.size() > 0){
|
|||
|
|
result.setData(sysOrgs);
|
|||
|
|
}else{
|
|||
|
|
result.setCode(Code.NO_DATA.getCode());
|
|||
|
|
result.setMessage(Message.NO_DATA);
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@ApiOperation(value = "部门角色", notes = "部门角色")
|
|||
|
|
@ApiImplicitParam(name = "unitId",value = "部门id",required = true)
|
|||
|
|
@GetMapping("unitRole/{unitId}")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<List<Map<String,String>>> unitRole(@PathVariable String unitId)throws Exception{
|
|||
|
|
SingleResult<List<Map<String,String>>> result = new SingleResult<>();
|
|||
|
|
System.out.println("unitId -> "+unitId);
|
|||
|
|
List<RoleInfo> roleInfos = sysUnitRoleMapper.roleAuthList(unitId);
|
|||
|
|
System.out.println("roleInfos -> "+JSONArray.toJSONString(roleInfos));
|
|||
|
|
|
|||
|
|
|
|||
|
|
List<Map<String,String>> resultMap = new LinkedList<>();
|
|||
|
|
|
|||
|
|
if(null != roleInfos && roleInfos.size() > 0){
|
|||
|
|
for (RoleInfo roleInfo : roleInfos){
|
|||
|
|
Map<String,String> roleMap = new LinkedHashMap<>();
|
|||
|
|
roleMap.put("roleId",roleInfo.getRoleId());
|
|||
|
|
roleMap.put("roleName",roleInfo.getRoleName());
|
|||
|
|
if(null != roleInfo.getRoleAuths() && roleInfo.getRoleAuths().size() > 0){
|
|||
|
|
for (RoleAuth roleAuth : roleInfo.getRoleAuths()){
|
|||
|
|
Integer authState = 2;
|
|||
|
|
if(StringUtils.isNotBlank(roleAuth.getUnitRoleId())){
|
|||
|
|
authState = 1;
|
|||
|
|
}
|
|||
|
|
roleMap.put(roleAuth.getAuthKey(),authState+"");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
resultMap.add(roleMap);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
result.setData(resultMap);
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
@ApiOperation(value = "所有部门权限", notes = "所有部门权限")
|
|||
|
|
@GetMapping("unitAuth")
|
|||
|
|
@ResponseBody
|
|||
|
|
public MultiResult<SysAuth> unitAuth()throws Exception{
|
|||
|
|
MultiResult<SysAuth> result = new MultiResult<>();
|
|||
|
|
List<SysAuth> auths = sysAuthMapper.findAll();
|
|||
|
|
result.setData(auths);
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@ApiOperation(value = "修改部门权限", notes = "修改部门权限")
|
|||
|
|
@PostMapping("unitAuthChange")
|
|||
|
|
@ResponseBody
|
|||
|
|
public SingleResult<SysAuth> unitAuthChange(@RequestBody UnitAuthChangeDto unitAuthChangeDto)throws Exception{
|
|||
|
|
SingleResult<SysAuth> result = new SingleResult<>();
|
|||
|
|
System.out.println("unitAuthChangeDto -> "+JSONArray.toJSONString(unitAuthChangeDto));
|
|||
|
|
|
|||
|
|
String userId = getUserId();
|
|||
|
|
|
|||
|
|
List<SysAuth> auths = sysAuthMapper.findAll();
|
|||
|
|
Map<String,String> authMap = new HashMap<>();
|
|||
|
|
for (SysAuth auth : auths){
|
|||
|
|
authMap.put(auth.getAuthKey(),auth.getAuthId());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
List<SysUnitRole> unitRoles = new ArrayList<>();
|
|||
|
|
|
|||
|
|
List<Map<String,String>> resultMap = unitAuthChangeDto.getResultMap();
|
|||
|
|
if(null != resultMap && resultMap.size() > 0){
|
|||
|
|
|
|||
|
|
|
|||
|
|
for (Map<String,String> roleInfoMap : resultMap){
|
|||
|
|
|
|||
|
|
|
|||
|
|
//角色id
|
|||
|
|
String roleId = roleInfoMap.get("roleId");
|
|||
|
|
|
|||
|
|
//获取角色权限信息
|
|||
|
|
for (Map.Entry<String,String> map : roleInfoMap.entrySet()){
|
|||
|
|
|
|||
|
|
//如果是权限的key 则判断是否选中
|
|||
|
|
String authId = authMap.get(map.getKey());
|
|||
|
|
if(StringUtils.isNotBlank(authId)){
|
|||
|
|
//如果value 等于 1 则说明选择了该权限
|
|||
|
|
if("1".equals(map.getValue())){
|
|||
|
|
SysUnitRole sysUnitRole = new SysUnitRole();
|
|||
|
|
sysUnitRole.setUnitRoleId(RandomNumber.getUUid());
|
|||
|
|
sysUnitRole.setUnitId(unitAuthChangeDto.getUnitId());
|
|||
|
|
sysUnitRole.setRoleId(roleId);
|
|||
|
|
sysUnitRole.setAuthId(authId);
|
|||
|
|
sysUnitRole.setModified(userId);
|
|||
|
|
sysUnitRole.setModifyTime(new Date());
|
|||
|
|
sysUnitRole.setCreated(userId);
|
|||
|
|
sysUnitRole.setCreateTime(new Date());
|
|||
|
|
unitRoles.add(sysUnitRole);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
System.out.println("unitRoles -> "+JSONArray.toJSONString(unitRoles));
|
|||
|
|
System.out.println("unitRoles SIZE -> "+unitRoles.size());
|
|||
|
|
|
|||
|
|
sysUnitRoleMapper.delByUnitId(unitAuthChangeDto.getUnitId());
|
|||
|
|
if(null != unitRoles && unitRoles.size() > 0){
|
|||
|
|
sysUnitRoleMapper.insertList(unitRoles);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 地区列表
|
|||
|
|
* @version v1.0
|
|||
|
|
* @author dong
|
|||
|
|
* @date 2022/8/5 10:36
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "地区列表", notes = "地区列表")
|
|||
|
|
@GetMapping("areaList")
|
|||
|
|
@ApiImplicitParam(name = "orgcode",value = "地区编号")
|
|||
|
|
@ResponseBody
|
|||
|
|
public MultiResult<SysOrg> areaList(String orgcode)throws Exception{
|
|||
|
|
MultiResult<SysOrg> result = new MultiResult<>();
|
|||
|
|
if(StringUtils.isBlank(orgcode)){
|
|||
|
|
orgcode = constantsConfigure.getSuperiorOrgCode();
|
|||
|
|
}
|
|||
|
|
List<SysOrg> sysOrgs = sysOrgMapper.findByParentId(orgcode);
|
|||
|
|
result.setData(sysOrgs);
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 文书模板列表
|
|||
|
|
* @version v1.0
|
|||
|
|
* @author dong
|
|||
|
|
* @date 2022/8/5 11:48
|
|||
|
|
*/
|
|||
|
|
@ApiOperation(value = "文书模板列表", notes = "文书模板列表")
|
|||
|
|
@GetMapping("tempList")
|
|||
|
|
@ApiImplicitParam(name = "condition",value = "关键字")
|
|||
|
|
@ResponseBody
|
|||
|
|
public MultiResult<SysDocumenttemp> tempList(String condition)throws Exception{
|
|||
|
|
MultiResult<SysDocumenttemp> result = new MultiResult<>();
|
|||
|
|
condition = TypeConversion.getCondition(condition);
|
|||
|
|
List<SysDocumenttemp> sysDocumenttemps = sysDocumenttempMapper.tempList(condition);
|
|||
|
|
result.setData(sysDocumenttemps);
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|