企业详情bug解决 和 用户导入
This commit is contained in:
parent
f4a838440b
commit
4a53d36c6f
|
|
@ -102,6 +102,11 @@ public interface ListPerformMapper {
|
|||
@Param("supClassId") String supClassId,
|
||||
@Param("sortId") Integer sortId);
|
||||
|
||||
/*查询岗位*/
|
||||
ListPerform findByPerformName(@Param("performClassName") String performClassName,
|
||||
@Param("supClassId") String supClassId,
|
||||
@Param("performName") String performName);
|
||||
|
||||
//部门列表
|
||||
List<ListPerform> findUnit(@Param("superPerformId") String superPerformId);
|
||||
|
||||
|
|
|
|||
|
|
@ -742,6 +742,14 @@
|
|||
AND lf.SortId = #{sortId}
|
||||
</select>
|
||||
|
||||
<!--查询岗位-->
|
||||
<select id="findByPerformName" resultMap="BaseResultMap">
|
||||
SELECT * FROM ListPerform lf
|
||||
WHERE lf.`PerformClassName` = #{performClassName}
|
||||
AND lf.`SupClassId` = #{supClassId}
|
||||
AND (lf.PerformName is null or lf.PerformName = '' or lf.PerformName = #{performName})
|
||||
</select>
|
||||
|
||||
|
||||
<!--岗位列表-->
|
||||
<select id="findUnit" resultMap="BaseResultMap">
|
||||
|
|
|
|||
|
|
@ -948,15 +948,12 @@
|
|||
LEFT JOIN ListPerform sp ON sp.`ListPerformId` = lf.`SupClassId`
|
||||
WHERE su.`UserType` = '政府用户'
|
||||
|
||||
and FIND_IN_SET(#{areaCode},su.area_code)
|
||||
<if test="State!=null and State!=''">
|
||||
and su.State = #{State}
|
||||
</if>
|
||||
|
||||
<if test="null != areaCode and '' != areaCode">
|
||||
and (su.`OrgCode` = #{areaCode}
|
||||
OR su.`street_code` = #{areaCode}
|
||||
OR su.`community_code` = #{areaCode})
|
||||
</if>
|
||||
|
||||
AND (su.`ChinaName` LIKE #{condition} OR su.`SysUserName` LIKE #{condition})
|
||||
<if test="null != unitId and '' != unitId">
|
||||
AND su.SysUnitOrEntId = #{unitId}
|
||||
|
|
@ -1257,7 +1254,7 @@
|
|||
|
||||
AND (su.`ChinaName` LIKE #{condition} OR su.`SysUserName` LIKE #{condition})
|
||||
AND su.SysUnitOrEntId = #{unitId}
|
||||
ORDER BY su.State ASC,su.ModifiedOn DESC
|
||||
ORDER BY lf.SysLevel asc,lf.SortId asc
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class PcCompanyController extends BaseController{
|
|||
@ResponseBody
|
||||
public SingleResult<String> companyDetail(String SysEnterpriseId)throws Exception {
|
||||
SingleResult singleResult = new SingleResult();
|
||||
List<SysEnterprise> sysEnterprises = sysEnterpriseMapper.companyDetail(SysEnterpriseId);
|
||||
List<SysEnterprise>sysEnterprises = sysEnterpriseMapper.companyDetail(SysEnterpriseId);
|
||||
List<String>safeClass = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(sysEnterprises.get(0).getBasesafeclassid())){
|
||||
safeClass = super.exchange(sysEnterprises.get(0).getBasesafeclassid(),1);
|
||||
|
|
@ -119,8 +119,11 @@ public class PcCompanyController extends BaseController{
|
|||
List<SysUnit> units = sysUnitMapper.findUnit("");
|
||||
String sysUnitId = sysEnterprises.get(0).getSysUnitId();
|
||||
String managerDept = sysEnterprises.get(0).getManagerDept();
|
||||
String [] arr=sysUnitId.split(",");
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String [] arr = null;
|
||||
if(StringUtils.isNotBlank(sysUnitId)){
|
||||
arr=sysUnitId.split(",");
|
||||
for (String i:arr) {
|
||||
for (SysUnit un:units) {
|
||||
if (un.getSysunitid().equals(managerDept)){
|
||||
|
|
@ -131,6 +134,8 @@ public class PcCompanyController extends BaseController{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(stringBuilder.toString())){
|
||||
sysEnterprises.get(0).setSysUnitName(stringBuilder.toString().substring(0,stringBuilder.toString().length()-1));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -976,6 +976,145 @@ public class DataController extends com.rzyc.controller.BaseController {
|
|||
index++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "导入用户", notes = "导入用户")
|
||||
@RequestMapping(value = "/importUser", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public SingleResult<String> importUser(@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();
|
||||
|
||||
|
||||
|
||||
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 name = "";
|
||||
String mobile = "";
|
||||
|
||||
|
||||
Cell cell = row.getCell((short) 1);
|
||||
unitName = dataFormatter.formatCellValue(cell);
|
||||
if (StringUtils.isBlank(unitName)) {
|
||||
unitName = unitNameStr;
|
||||
} else {
|
||||
unitNameStr = unitName;
|
||||
}
|
||||
|
||||
cell = row.getCell((short) 2);
|
||||
postName = dataFormatter.formatCellValue(cell);
|
||||
if (StringUtils.isBlank(postName)) {
|
||||
postName = postNameStr;
|
||||
} else {
|
||||
postNameStr = postName;
|
||||
}
|
||||
|
||||
cell = row.getCell((short) 3);
|
||||
name = dataFormatter.formatCellValue(cell);
|
||||
|
||||
|
||||
cell = row.getCell((short) 4);
|
||||
mobile = dataFormatter.formatCellValue(cell);
|
||||
|
||||
|
||||
System.out.println("-----------------"+index);
|
||||
System.out.println(unitName);
|
||||
System.out.println(postName);
|
||||
System.out.println(name);
|
||||
System.out.println(mobile);
|
||||
|
||||
|
||||
ListPerform superPerform = listPerformMapper.findByName(unitName,"5bd164aa-dd43-45e3-a5a2-649bb2fd9fb9");
|
||||
if(null != superPerform){
|
||||
ListPerform listPerform = listPerformMapper.findByPerformName(postName,superPerform.getListperformid(),name);
|
||||
if(null == listPerform){
|
||||
listPerform = new ListPerform();
|
||||
listPerform.setListperformid(RandomNumber.getUUid());
|
||||
listPerform.setSyslevel(superPerform.getSyslevel()+1);
|
||||
listPerform.setPerformclassname(postName);
|
||||
listPerform.setPerformName(name);
|
||||
listPerform.setSortid(50);
|
||||
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);
|
||||
}
|
||||
|
||||
SysUnit sysUnit = sysUnitMapper.findByUnitName(unitName,"f618c8e4-c0ea-426a-8f91-5ef31cf70299");
|
||||
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setSysuserid(RandomNumber.getUUid());
|
||||
sysUser.setUsertype("政府用户");
|
||||
sysUser.setAreaCode("513300");
|
||||
sysUser.setAreaPath("510000,513300");
|
||||
sysUser.setAreaName("四川省,甘孜藏族自治州");
|
||||
if(null != sysUnit){
|
||||
sysUser.setSysunitorentid(sysUnit.getSysunitid());
|
||||
sysUser.setUnitPath(sysUnit.getParentPath());
|
||||
sysUser.setUnitPathName(sysUnit.getParentName());
|
||||
}
|
||||
sysUser.setSysusername(mobile);
|
||||
sysUser.setSyspassword(PasswdFactory.encryptPasswd(sysUser.getSysuserid(),"",mobile));
|
||||
sysUser.setUserroles("cc89b58e-9ab4-492e-a184-82f199c75d76");
|
||||
sysUser.setChinaname(name);
|
||||
sysUser.setSystitle(listPerform.getListperformid());
|
||||
sysUser.setPostPath(listPerform.getParentPath());
|
||||
sysUser.setPostName(listPerform.getParentName());
|
||||
sysUser.setMobiletel(mobile);
|
||||
sysUser.setState("启用");
|
||||
sysUser.setCreatedby("excel");
|
||||
sysUser.setModifiedby("excel");
|
||||
sysUser.setCreatedon(new Date());
|
||||
sysUser.setModifiedon(new Date());
|
||||
sysUserMapper.insert(sysUser);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user