单位修改
This commit is contained in:
parent
1695e4f4cb
commit
a4167a5ad6
|
|
@ -12,7 +12,6 @@ public class ChangeUnitDto {
|
||||||
@ApiModelProperty(value = "部门id",required = true)
|
@ApiModelProperty(value = "部门id",required = true)
|
||||||
private String sysunitid;
|
private String sysunitid;
|
||||||
|
|
||||||
@NotNull(message = "地区不能为空")
|
|
||||||
@ApiModelProperty(value = "地区编码",required = true)
|
@ApiModelProperty(value = "地区编码",required = true)
|
||||||
private String orgcode;
|
private String orgcode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ import com.common.utils.encryption.PasswdFactory;
|
||||||
import com.common.utils.model.SingleResult;
|
import com.common.utils.model.SingleResult;
|
||||||
import com.rzyc.enums.DelState;
|
import com.rzyc.enums.DelState;
|
||||||
import com.rzyc.model.*;
|
import com.rzyc.model.*;
|
||||||
|
import com.rzyc.model.check.ChkBillDetailWithBLOBs;
|
||||||
import com.rzyc.model.ent.SysEnterprise;
|
import com.rzyc.model.ent.SysEnterprise;
|
||||||
import com.rzyc.model.organization.OrgBatch;
|
import com.rzyc.model.organization.OrgBatch;
|
||||||
import com.rzyc.model.organization.OrgDanger;
|
import com.rzyc.model.organization.OrgDanger;
|
||||||
import com.rzyc.model.user.ListFactor;
|
import com.rzyc.model.user.*;
|
||||||
import com.rzyc.model.user.SysUser;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
|
@ -21,10 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Api(tags = "数据处理")
|
@Api(tags = "数据处理")
|
||||||
@Controller
|
@Controller
|
||||||
|
|
@ -639,4 +636,173 @@ public class DataController extends com.rzyc.controller.BaseController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "导入岗位", notes = "导入岗位")
|
||||||
|
@RequestMapping(value = "/importPost", method = RequestMethod.POST)
|
||||||
|
@ResponseBody
|
||||||
|
public SingleResult<String> importPost(@RequestBody MultipartFile multipartFile)throws Exception{
|
||||||
|
SingleResult<String> result = new SingleResult<>();
|
||||||
|
Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream());
|
||||||
|
Sheet sheet = wookbook.getSheetAt(0);
|
||||||
|
|
||||||
|
//获得表头
|
||||||
|
Row rowHead = sheet.getRow(0);
|
||||||
|
|
||||||
|
System.out.println("getPhysicalNumberOfCells -> "+rowHead.getPhysicalNumberOfCells());
|
||||||
|
//判断表头是否正确
|
||||||
|
if(true){
|
||||||
|
//获得数据的总行数
|
||||||
|
int totalRowNum = sheet.getLastRowNum();
|
||||||
|
|
||||||
|
if(totalRowNum > 0){
|
||||||
|
|
||||||
|
Boolean isSubject = true;
|
||||||
|
DataFormatter dataFormatter = new DataFormatter();
|
||||||
|
|
||||||
|
Map<String,String> sortMap = new LinkedHashMap<>();
|
||||||
|
Map<String,String> workDivisionMap = new HashMap<>();
|
||||||
|
Map<String,String> performNameMap = new HashMap<>();
|
||||||
|
Map<String,List<String>> dutyMap = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
Integer index = 1;
|
||||||
|
String unitNameStr = "";
|
||||||
|
String postNameStr = "";
|
||||||
|
String sortStrStr = "";
|
||||||
|
//获得所有数据
|
||||||
|
for(int i = 1 ; i <= totalRowNum ; i++){
|
||||||
|
//获得第i行对象
|
||||||
|
Row row = sheet.getRow(i);
|
||||||
|
if(null == row){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
String unitName = "";
|
||||||
|
String postName = "";
|
||||||
|
String sortStr = "";
|
||||||
|
String workDivision = "";
|
||||||
|
String dutyList = "";
|
||||||
|
String performList = "";
|
||||||
|
String performName = "";
|
||||||
|
|
||||||
|
String mapKey = "";
|
||||||
|
|
||||||
|
Cell cell = row.getCell((short)0);
|
||||||
|
unitName = dataFormatter.formatCellValue(cell);
|
||||||
|
if(StringUtils.isBlank(unitName)){
|
||||||
|
unitName = unitNameStr;
|
||||||
|
}else{
|
||||||
|
unitNameStr = unitName;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell = row.getCell((short)1);
|
||||||
|
postName = dataFormatter.formatCellValue(cell);
|
||||||
|
if(StringUtils.isBlank(postName)){
|
||||||
|
postName = postNameStr;
|
||||||
|
}else{
|
||||||
|
postNameStr = postName;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapKey = unitName + "---"+postName;
|
||||||
|
|
||||||
|
cell = row.getCell((short)2);
|
||||||
|
sortStr = dataFormatter.formatCellValue(cell);
|
||||||
|
if(StringUtils.isBlank(sortStr)){
|
||||||
|
sortStr = sortStrStr;
|
||||||
|
}else{
|
||||||
|
sortStrStr = sortStr;
|
||||||
|
}
|
||||||
|
mapKey = unitName + "---"+postName+"---"+sortStrStr;
|
||||||
|
sortMap.put(mapKey,sortStr);
|
||||||
|
|
||||||
|
|
||||||
|
cell = row.getCell((short)3);
|
||||||
|
workDivision = dataFormatter.formatCellValue(cell);
|
||||||
|
if(StringUtils.isNotBlank(workDivision)){
|
||||||
|
workDivisionMap.put(mapKey,workDivision);
|
||||||
|
}
|
||||||
|
|
||||||
|
cell = row.getCell((short)4);
|
||||||
|
dutyList = dataFormatter.formatCellValue(cell);
|
||||||
|
if(StringUtils.isNotBlank(dutyList)){
|
||||||
|
List<String> dutys = new LinkedList<>();
|
||||||
|
if(dutyMap.containsKey(mapKey)){
|
||||||
|
dutys = dutyMap.get(mapKey);
|
||||||
|
}
|
||||||
|
dutys.add(dutyList);
|
||||||
|
dutyMap.put(mapKey,dutys);
|
||||||
|
}
|
||||||
|
|
||||||
|
cell = row.getCell((short)5);
|
||||||
|
performList = dataFormatter.formatCellValue(cell);
|
||||||
|
|
||||||
|
cell = row.getCell((short)6);
|
||||||
|
performName = dataFormatter.formatCellValue(cell);
|
||||||
|
if(StringUtils.isNotBlank(performName)){
|
||||||
|
performNameMap.put(mapKey,performName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// System.out.println("-----------------"+index);
|
||||||
|
// System.out.println(unitName);
|
||||||
|
// System.out.println(postName);
|
||||||
|
// System.out.println(sortStr);
|
||||||
|
// System.out.println(dutyList);
|
||||||
|
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (Map.Entry<String,String> entry : sortMap.entrySet()){
|
||||||
|
System.out.println("部门岗位 -》 "+entry.getKey());
|
||||||
|
System.out.println("排序 -》 "+entry.getValue());
|
||||||
|
System.out.println("工作分工 -》 "+workDivisionMap.get(entry.getKey()));
|
||||||
|
System.out.println("责任人 -》 "+performNameMap.get(entry.getKey()));
|
||||||
|
System.out.println("职责清单 -》 "+JSONArray.toJSONString(dutyMap.get(entry.getKey())));
|
||||||
|
String[] strs = entry.getKey().split("---");
|
||||||
|
ListPerform superPerform = listPerformMapper.findByName(strs[0],"5bd164aa-dd43-45e3-a5a2-649bb2fd9fb9");
|
||||||
|
if(null != superPerform){
|
||||||
|
ListPerform listPerform = new ListPerform();
|
||||||
|
listPerform.setListperformid(RandomNumber.getUUid());
|
||||||
|
listPerform.setSyslevel(superPerform.getSyslevel()+1);
|
||||||
|
listPerform.setPerformclassname(strs[1]);
|
||||||
|
listPerform.setPerformName(performNameMap.get(entry.getKey()));
|
||||||
|
listPerform.setSortid(TypeConversion.StringToInteger(entry.getValue()));
|
||||||
|
listPerform.setSupclassid(superPerform.getListperformid());
|
||||||
|
listPerform.setCompletion("0");
|
||||||
|
listPerform.setParentPath(superPerform.getParentPath()+","+listPerform.getListperformid());
|
||||||
|
listPerform.setParentName(superPerform.getParentName()+","+listPerform.getPerformclassname());
|
||||||
|
listPerform.setCreatedby("excel");
|
||||||
|
listPerform.setModifiedby("excel");
|
||||||
|
listPerform.setCreatedon(new Date());
|
||||||
|
listPerform.setModifiedon(new Date());
|
||||||
|
listPerformMapper.insert(listPerform);
|
||||||
|
|
||||||
|
List<String> dutyLists = dutyMap.get(entry.getKey());
|
||||||
|
if(null != dutyLists && dutyLists.size() > 0){
|
||||||
|
Integer sortId = 1;
|
||||||
|
for (String dutyStr : dutyLists){
|
||||||
|
|
||||||
|
ListSafeWithBLOBs listSafe = new ListSafeWithBLOBs();
|
||||||
|
listSafe.setListsafeid(RandomNumber.getUUid());
|
||||||
|
listSafe.setListperformid(listPerform.getListperformid());
|
||||||
|
listSafe.setSortid(sortId);
|
||||||
|
listSafe.setSafeduty(dutyStr);
|
||||||
|
listSafe.setCreatedby("excel");
|
||||||
|
listSafe.setModifiedby("excel");
|
||||||
|
listSafe.setCreatedon(new Date());
|
||||||
|
listSafe.setModifiedon(new Date());
|
||||||
|
listSafeMapper.insert(listSafe);
|
||||||
|
sortId++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user