575 lines
21 KiB
Java
575 lines
21 KiB
Java
|
|
package com.rzyc.controller;
|
||
|
|
|
||
|
|
import com.alibaba.fastjson.JSONArray;
|
||
|
|
import com.common.utils.RandomNumber;
|
||
|
|
import com.common.utils.StringUtils;
|
||
|
|
import com.common.utils.TypeConversion;
|
||
|
|
import com.common.utils.model.SingleResult;
|
||
|
|
import com.rzyc.enums.DelState;
|
||
|
|
import com.rzyc.model.*;
|
||
|
|
import com.rzyc.model.ent.SysEnterprise;
|
||
|
|
import com.rzyc.model.organization.OrgBatch;
|
||
|
|
import com.rzyc.model.organization.OrgDanger;
|
||
|
|
import com.rzyc.model.user.ListFactor;
|
||
|
|
import com.rzyc.model.user.SysUser;
|
||
|
|
import io.swagger.annotations.Api;
|
||
|
|
import io.swagger.annotations.ApiOperation;
|
||
|
|
import org.apache.poi.ss.usermodel.*;
|
||
|
|
import org.springframework.stereotype.Controller;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
import org.springframework.web.multipart.MultipartFile;
|
||
|
|
|
||
|
|
import java.io.File;
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.Calendar;
|
||
|
|
import java.util.Date;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
@Api(tags = "数据处理")
|
||
|
|
@Controller
|
||
|
|
@CrossOrigin("*")
|
||
|
|
@RequestMapping("data")
|
||
|
|
public class DataController extends com.rzyc.controller.BaseController {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 功能区地区用户处理
|
||
|
|
* @param multipartFile
|
||
|
|
* @return
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@ApiOperation(value = "功能区地区用户处理", notes = "功能区地区用户处理")
|
||
|
|
@RequestMapping(value = "/importAreaUser", method = RequestMethod.POST)
|
||
|
|
@ResponseBody
|
||
|
|
public SingleResult<String> importAreaUser(@RequestBody MultipartFile multipartFile)throws Exception{
|
||
|
|
SingleResult<String> result = new SingleResult<>();
|
||
|
|
handleAreaUser(multipartFile);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 街道导入驻村干部
|
||
|
|
* @param multipartFile
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
public void handleAreaUser(MultipartFile multipartFile)throws Exception{
|
||
|
|
if(null != multipartFile){
|
||
|
|
Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream());
|
||
|
|
Sheet sheet = wookbook.getSheetAt(0);
|
||
|
|
DataFormatter dataFormatter = new DataFormatter();
|
||
|
|
//获得表头
|
||
|
|
Row rowHead = sheet.getRow(0);
|
||
|
|
|
||
|
|
System.out.println("getPhysicalNumberOfCells -> "+rowHead.getPhysicalNumberOfCells());
|
||
|
|
//判断表头是否正确
|
||
|
|
if(true){
|
||
|
|
//获得数据的总行数
|
||
|
|
int totalRowNum = sheet.getLastRowNum();
|
||
|
|
|
||
|
|
if(totalRowNum > 0){
|
||
|
|
|
||
|
|
Boolean isSubject = true;
|
||
|
|
|
||
|
|
String superId = "510114118000";
|
||
|
|
|
||
|
|
//获得所有数据
|
||
|
|
for(int i = 1 ; i <= totalRowNum ; i++) {
|
||
|
|
|
||
|
|
int index = i + 1;
|
||
|
|
//获得第i行对象
|
||
|
|
Row row = sheet.getRow(i);
|
||
|
|
if (null == row) {
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
String netName = "";
|
||
|
|
String chinaNames = "";
|
||
|
|
|
||
|
|
|
||
|
|
Cell cell = row.getCell((short) 0);
|
||
|
|
if (null != cell) {
|
||
|
|
netName = dataFormatter.formatCellValue(cell);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
cell = row.getCell((short) 1);
|
||
|
|
if (null != cell) {
|
||
|
|
chinaNames = dataFormatter.formatCellValue(cell);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
netName = StringUtils.replaceBlank(netName);
|
||
|
|
chinaNames = StringUtils.replaceBlank(chinaNames);
|
||
|
|
|
||
|
|
System.out.println(netName + "-" + chinaNames);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
SysOrg sysOrg = sysOrgMapper.findByName(netName,superId);
|
||
|
|
if(null == sysOrg){
|
||
|
|
sysOrg = new SysOrg();
|
||
|
|
sysOrg.setOrgcode(RandomNumber.getUUid());
|
||
|
|
sysOrg.setOrgname(netName);
|
||
|
|
sysOrg.setOrglevel(4);
|
||
|
|
sysOrg.setSuperiororgcode(superId);
|
||
|
|
sysOrg.setCreatedby("导入");
|
||
|
|
sysOrg.setCreatedon(new Date());
|
||
|
|
sysOrg.setModifiedby("导入");
|
||
|
|
sysOrg.setModifiedon(new Date());
|
||
|
|
sysOrgMapper.insert(sysOrg);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
String[] strs = chinaNames.split("、");
|
||
|
|
if(null != strs && strs.length > 0){
|
||
|
|
for (String str : strs){
|
||
|
|
SysUser sysUser = sysUserMapper.findByStreet(superId,str);
|
||
|
|
if(null != sysUser){
|
||
|
|
sysUserMapper.changeCommunityCode(sysUser.getSysuserid(),sysOrg.getOrgcode());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 功能区地区企业处理
|
||
|
|
* @param multipartFile
|
||
|
|
* @return
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@ApiOperation(value = "功能区地区企业处理", notes = "功能区地区企业处理")
|
||
|
|
@RequestMapping(value = "/importAreaEnt", method = RequestMethod.POST)
|
||
|
|
@ResponseBody
|
||
|
|
public SingleResult<String> importAreaEnt(@RequestBody MultipartFile multipartFile)throws Exception{
|
||
|
|
SingleResult<String> result = new SingleResult<>();
|
||
|
|
handleAreaEnt(multipartFile);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 街道导入驻村干部
|
||
|
|
* @param multipartFile
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
public void handleAreaEnt(MultipartFile multipartFile)throws Exception{
|
||
|
|
if(null != multipartFile){
|
||
|
|
Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream());
|
||
|
|
Sheet sheet = wookbook.getSheetAt(0);
|
||
|
|
DataFormatter dataFormatter = new DataFormatter();
|
||
|
|
//获得表头
|
||
|
|
Row rowHead = sheet.getRow(0);
|
||
|
|
|
||
|
|
System.out.println("getPhysicalNumberOfCells -> "+rowHead.getPhysicalNumberOfCells());
|
||
|
|
//判断表头是否正确
|
||
|
|
if(true){
|
||
|
|
//获得数据的总行数
|
||
|
|
int totalRowNum = sheet.getLastRowNum();
|
||
|
|
|
||
|
|
if(totalRowNum > 0){
|
||
|
|
|
||
|
|
Boolean isSubject = true;
|
||
|
|
|
||
|
|
String superId = "510114118000";
|
||
|
|
|
||
|
|
//获得所有数据
|
||
|
|
for(int i = 1 ; i <= totalRowNum ; i++) {
|
||
|
|
|
||
|
|
int index = i + 1;
|
||
|
|
//获得第i行对象
|
||
|
|
Row row = sheet.getRow(i);
|
||
|
|
if (null == row) {
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
String netName = "";
|
||
|
|
String entName = "";
|
||
|
|
|
||
|
|
|
||
|
|
Cell cell = row.getCell((short) 0);
|
||
|
|
if (null != cell) {
|
||
|
|
netName = dataFormatter.formatCellValue(cell);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
cell = row.getCell((short) 1);
|
||
|
|
if (null != cell) {
|
||
|
|
entName = dataFormatter.formatCellValue(cell);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
netName = StringUtils.replaceBlank(netName);
|
||
|
|
entName = StringUtils.replaceBlank(entName);
|
||
|
|
|
||
|
|
System.out.println(netName + "-" + entName);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
SysOrg sysOrg = sysOrgMapper.findByName(netName,superId);
|
||
|
|
if(null == sysOrg){
|
||
|
|
sysOrg = new SysOrg();
|
||
|
|
sysOrg.setOrgcode(RandomNumber.getUUid());
|
||
|
|
sysOrg.setOrgname(netName);
|
||
|
|
sysOrg.setOrglevel(4);
|
||
|
|
sysOrg.setSuperiororgcode(superId);
|
||
|
|
sysOrg.setCreatedby("导入");
|
||
|
|
sysOrg.setCreatedon(new Date());
|
||
|
|
sysOrg.setModifiedby("导入");
|
||
|
|
sysOrg.setModifiedon(new Date());
|
||
|
|
sysOrgMapper.insert(sysOrg);
|
||
|
|
}
|
||
|
|
if(StringUtils.isNotBlank(entName)){
|
||
|
|
SysEnterprise enterprise = sysEnterpriseMapper.findByName(entName);
|
||
|
|
if(null != enterprise && superId.equals(enterprise.getStreetCode())){
|
||
|
|
sysEnterpriseMapper.changeCommunityCode(enterprise.getSysenterpriseid(),sysOrg.getOrgcode());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 石板滩用户责任树
|
||
|
|
* @param multipartFile
|
||
|
|
* @return
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@ApiOperation(value = "石板滩用户责任树", notes = "石板滩用户责任树")
|
||
|
|
@RequestMapping(value = "/userDutyTree", method = RequestMethod.POST)
|
||
|
|
@ResponseBody
|
||
|
|
public SingleResult<String> userDutyTree(@RequestBody MultipartFile multipartFile)throws Exception{
|
||
|
|
SingleResult<String> result = new SingleResult<>();
|
||
|
|
handleUserDutyTree(multipartFile);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 街道导入驻村干部
|
||
|
|
* @param multipartFile
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
public void handleUserDutyTree(MultipartFile multipartFile)throws Exception{
|
||
|
|
if(null != multipartFile){
|
||
|
|
Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream());
|
||
|
|
Sheet sheet = wookbook.getSheetAt(0);
|
||
|
|
DataFormatter dataFormatter = new DataFormatter();
|
||
|
|
//获得表头
|
||
|
|
Row rowHead = sheet.getRow(0);
|
||
|
|
|
||
|
|
System.out.println("getPhysicalNumberOfCells -> "+rowHead.getPhysicalNumberOfCells());
|
||
|
|
//判断表头是否正确
|
||
|
|
if(true){
|
||
|
|
//获得数据的总行数
|
||
|
|
int totalRowNum = sheet.getLastRowNum();
|
||
|
|
|
||
|
|
if(totalRowNum > 0){
|
||
|
|
|
||
|
|
Boolean isSubject = true;
|
||
|
|
|
||
|
|
String superId = "510114102000";
|
||
|
|
String leaderUserName = "";
|
||
|
|
|
||
|
|
SysUser leaderUser = new SysUser();
|
||
|
|
|
||
|
|
//获得所有数据
|
||
|
|
for(int i = 1 ; i <= totalRowNum ; i++) {
|
||
|
|
|
||
|
|
int index = i + 1;
|
||
|
|
//获得第i行对象
|
||
|
|
Row row = sheet.getRow(i);
|
||
|
|
if (null == row) {
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
String userName = "";
|
||
|
|
String mobile = "";
|
||
|
|
|
||
|
|
|
||
|
|
Cell cell = row.getCell((short) 0);
|
||
|
|
if (null != cell) {
|
||
|
|
String leaderStr = dataFormatter.formatCellValue(cell);
|
||
|
|
if(StringUtils.isNotBlank(leaderStr)){
|
||
|
|
leaderUserName = leaderStr;
|
||
|
|
leaderUser = sysUserMapper.findBySysUserName(leaderUserName);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
cell = row.getCell((short) 1);
|
||
|
|
if (null != cell) {
|
||
|
|
userName = dataFormatter.formatCellValue(cell);
|
||
|
|
}
|
||
|
|
cell = row.getCell((short) 2);
|
||
|
|
if (null != cell) {
|
||
|
|
mobile = dataFormatter.formatCellValue(cell);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
leaderUserName = StringUtils.replaceBlank(leaderUserName);
|
||
|
|
userName = StringUtils.replaceBlank(userName);
|
||
|
|
mobile = StringUtils.replaceBlank(mobile);
|
||
|
|
|
||
|
|
|
||
|
|
if(null != leaderUser){
|
||
|
|
System.out.println(leaderUserName + " - " + userName+" - "+mobile);
|
||
|
|
System.out.println("laader ---------------> "+leaderUser.getSysuserid());
|
||
|
|
|
||
|
|
|
||
|
|
SysUser sysUser = sysUserMapper.findByStreetAndName(superId,userName,mobile);
|
||
|
|
if(null != sysUser){
|
||
|
|
DutyTree dutyTree = new DutyTree();
|
||
|
|
dutyTree.setDutyTreeId(RandomNumber.getUUid());
|
||
|
|
dutyTree.setUserId(leaderUser.getSysuserid());
|
||
|
|
dutyTree.setTargetId(sysUser.getSysuserid());
|
||
|
|
dutyTree.setTargetType(1);
|
||
|
|
dutyTree.setModified("导入");
|
||
|
|
dutyTree.setModifyTime(new Date());
|
||
|
|
dutyTree.setCreated("导入");
|
||
|
|
dutyTree.setCreateTime(new Date());
|
||
|
|
dutyTreeMapper.insert(dutyTree);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
System.out.println();
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 石板滩企业责任树
|
||
|
|
* @param multipartFile
|
||
|
|
* @return
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
@ApiOperation(value = "石板滩企业责任树", notes = "石板滩企业责任树")
|
||
|
|
@RequestMapping(value = "/entDutyTree", method = RequestMethod.POST)
|
||
|
|
@ResponseBody
|
||
|
|
public SingleResult<String> entDutyTree(@RequestBody MultipartFile multipartFile)throws Exception{
|
||
|
|
SingleResult<String> result = new SingleResult<>();
|
||
|
|
handleEntDutyTree(multipartFile);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 街道导入驻村干部
|
||
|
|
* @param multipartFile
|
||
|
|
* @throws Exception
|
||
|
|
*/
|
||
|
|
public void handleEntDutyTree(MultipartFile multipartFile)throws Exception{
|
||
|
|
if(null != multipartFile){
|
||
|
|
Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream());
|
||
|
|
Sheet sheet = wookbook.getSheetAt(0);
|
||
|
|
DataFormatter dataFormatter = new DataFormatter();
|
||
|
|
//获得表头
|
||
|
|
Row rowHead = sheet.getRow(0);
|
||
|
|
|
||
|
|
System.out.println("getPhysicalNumberOfCells -> "+rowHead.getPhysicalNumberOfCells());
|
||
|
|
//判断表头是否正确
|
||
|
|
if(true){
|
||
|
|
//获得数据的总行数
|
||
|
|
int totalRowNum = sheet.getLastRowNum();
|
||
|
|
|
||
|
|
if(totalRowNum > 0){
|
||
|
|
|
||
|
|
Boolean isSubject = true;
|
||
|
|
|
||
|
|
String superId = "510114102000";
|
||
|
|
|
||
|
|
//获得所有数据
|
||
|
|
for(int i = 1 ; i <= totalRowNum ; i++) {
|
||
|
|
|
||
|
|
int index = i + 1;
|
||
|
|
//获得第i行对象
|
||
|
|
Row row = sheet.getRow(i);
|
||
|
|
if (null == row) {
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
String userName = "";
|
||
|
|
String mobile = "";
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
Cell cell = row.getCell((short) 1);
|
||
|
|
if (null != cell) {
|
||
|
|
userName = dataFormatter.formatCellValue(cell);
|
||
|
|
}
|
||
|
|
|
||
|
|
cell = row.getCell((short) 2);
|
||
|
|
if (null != cell) {
|
||
|
|
mobile = dataFormatter.formatCellValue(cell);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
userName = StringUtils.replaceBlank(userName);
|
||
|
|
mobile = StringUtils.replaceBlank(mobile);
|
||
|
|
|
||
|
|
|
||
|
|
List<String> entNames = new ArrayList<>();
|
||
|
|
for (int j = 3;j<=24;j++){
|
||
|
|
cell = row.getCell((short) j);
|
||
|
|
if (null != cell) {
|
||
|
|
String entName = dataFormatter.formatCellValue(cell);
|
||
|
|
if(StringUtils.isNotBlank(entName)){
|
||
|
|
entName = StringUtils.replaceBlank(entName);
|
||
|
|
entNames.add(entName);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
System.out.println(userName+" - "+mobile);
|
||
|
|
System.out.println("entNames -> "+JSONArray.toJSONString(entNames));
|
||
|
|
|
||
|
|
SysUser sysUser = sysUserMapper.findByStreetAndName(superId,userName,mobile);
|
||
|
|
if(null != sysUser){
|
||
|
|
for (String entName : entNames){
|
||
|
|
SysEnterprise enterprise = sysEnterpriseMapper.findByName(entName);
|
||
|
|
if(null != enterprise){
|
||
|
|
DutyTree dutyTree = new DutyTree();
|
||
|
|
dutyTree.setDutyTreeId(RandomNumber.getUUid());
|
||
|
|
dutyTree.setUserId(sysUser.getSysuserid());
|
||
|
|
dutyTree.setTargetId(enterprise.getSysenterpriseid());
|
||
|
|
dutyTree.setTargetType(2);
|
||
|
|
dutyTree.setModified("导入");
|
||
|
|
dutyTree.setModifyTime(new Date());
|
||
|
|
dutyTree.setCreated("导入");
|
||
|
|
dutyTree.setCreateTime(new Date());
|
||
|
|
dutyTreeMapper.insert(dutyTree);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
System.out.println();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@ApiOperation(value = "履职处理", notes = "履职处理")
|
||
|
|
@RequestMapping(value = "/handleFactor", method = RequestMethod.POST)
|
||
|
|
@ResponseBody
|
||
|
|
public SingleResult<String> handleFactor()throws Exception{
|
||
|
|
SingleResult<String> result = new SingleResult<>();
|
||
|
|
|
||
|
|
//超级管理员
|
||
|
|
String userId = "8D35010B-EB9A-40EE-BDEB-CDAE969D5EF4";
|
||
|
|
|
||
|
|
Integer nowYear = Calendar.getInstance().get(Calendar.YEAR);
|
||
|
|
Integer lastYear = nowYear - 1;
|
||
|
|
|
||
|
|
System.out.println("nowYear -> "+nowYear);
|
||
|
|
System.out.println("lastYear -> "+lastYear);
|
||
|
|
|
||
|
|
List<ListFactor> listFactors = listFactorMapper.findBySysYear(lastYear+"");
|
||
|
|
for(ListFactor listFactor : listFactors){
|
||
|
|
listFactor.setListfactorid(RandomNumber.getUUid());
|
||
|
|
listFactor.setIsfinish("否");
|
||
|
|
listFactor.setFinishProgres(0+"");
|
||
|
|
listFactor.setSysyear(nowYear+"");
|
||
|
|
listFactor.setDelState(DelState.NOT_DEL.getState());
|
||
|
|
listFactor.setCreatedby("导入");
|
||
|
|
listFactor.setCreatedon(new Date());
|
||
|
|
listFactor.setModifiedby("导入");
|
||
|
|
listFactor.setModifiedon(new Date());
|
||
|
|
listFactorMapper.insert(listFactor);
|
||
|
|
addFactorTask(listFactor,userId);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@ApiOperation(value = "三方机构隐患", notes = "三方机构隐患")
|
||
|
|
@RequestMapping(value = "/handleDanger", method = RequestMethod.POST)
|
||
|
|
@ResponseBody
|
||
|
|
public SingleResult<String> handleDanger()throws Exception{
|
||
|
|
SingleResult<String> result = new SingleResult<>();
|
||
|
|
|
||
|
|
|
||
|
|
List<OrgDanger> orgDangers = orgDangerMapper.findAll();
|
||
|
|
for(OrgDanger orgDanger : orgDangers){
|
||
|
|
System.out.println("-------------> "+orgDanger.getContent());
|
||
|
|
|
||
|
|
OrgBatch orgBatch = orgBatchMapper.findById(orgDanger.getBatchId());
|
||
|
|
if(null == orgBatch){
|
||
|
|
orgBatch = new OrgBatch();
|
||
|
|
orgBatch.setBatchId(orgDanger.getBatchId());
|
||
|
|
orgBatch.setUserId(orgDanger.getCreated());
|
||
|
|
orgBatch.setEnterpriseId(orgDanger.getEnterpriseId());
|
||
|
|
orgBatch.setOrganizationId(orgDanger.getOrganizationId());
|
||
|
|
orgBatch.setOrgType(1);
|
||
|
|
orgBatch.setCreated(orgDanger.getCreated());
|
||
|
|
orgBatch.setCreateTime(orgDanger.getCreateTime());
|
||
|
|
orgBatch.setModify(orgDanger.getCreated());
|
||
|
|
orgBatch.setModifyTime(orgDanger.getCreateTime());
|
||
|
|
orgBatchMapper.insert(orgBatch);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 导入模板
|
||
|
|
* @version v1.0
|
||
|
|
* @author dong
|
||
|
|
* @date 2022/8/5 13:36
|
||
|
|
*/
|
||
|
|
@ApiOperation(value = "导入模板", notes = "导入模板")
|
||
|
|
@RequestMapping(value = "/addTemp", method = RequestMethod.GET)
|
||
|
|
@ResponseBody
|
||
|
|
public SingleResult<String> addTemp()throws Exception{
|
||
|
|
SingleResult<String> result = new SingleResult<>();
|
||
|
|
String path = "C:\\mnt\\resource\\citysafexc\\documenttemp";
|
||
|
|
File file = new File(path);
|
||
|
|
File[] tempList = file.listFiles();
|
||
|
|
for (int i = 0; i < tempList.length; i++) {
|
||
|
|
if (tempList[i].isFile()) {
|
||
|
|
|
||
|
|
|
||
|
|
String name = tempList[i].getName();
|
||
|
|
String sortStr = name.substring(0,2);
|
||
|
|
SysDocumenttemp temp = new SysDocumenttemp();
|
||
|
|
temp.setTempId(RandomNumber.getUUid());
|
||
|
|
temp.setCreateTime(new Date());
|
||
|
|
temp.setModifyTime(new Date());
|
||
|
|
temp.setCreateBy("excel");
|
||
|
|
temp.setModifyBy("excel");
|
||
|
|
temp.setTempName(name);
|
||
|
|
temp.setSortId(TypeConversion.StringToInteger(sortStr));
|
||
|
|
temp.setTempPath("resource/citysafexc/documenttemp/"+name);
|
||
|
|
sysDocumenttempMapper.insert(temp);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|