diff --git a/inventory-dao/src/main/java/com/rzyc/mapper/user/ListFactorMapper.java b/inventory-dao/src/main/java/com/rzyc/mapper/user/ListFactorMapper.java index a3ae60d..710a0ac 100644 --- a/inventory-dao/src/main/java/com/rzyc/mapper/user/ListFactorMapper.java +++ b/inventory-dao/src/main/java/com/rzyc/mapper/user/ListFactorMapper.java @@ -97,4 +97,7 @@ public interface ListFactorMapper { /*履职记录关联的履职清单*/ List detailFactors(@Param("detailId") String detailId); + + /*查询本年度履职清单*/ + List findAllByYear(@Param("yearStr") String yearStr); } diff --git a/inventory-dao/src/main/resources/mapper/user/ListFactorMapper.xml b/inventory-dao/src/main/resources/mapper/user/ListFactorMapper.xml index 6626c20..8dbd2e4 100644 --- a/inventory-dao/src/main/resources/mapper/user/ListFactorMapper.xml +++ b/inventory-dao/src/main/resources/mapper/user/ListFactorMapper.xml @@ -754,4 +754,15 @@ WHERE lr.`detail_id` = #{detailId} AND lr.`target_type` = 1 + + + diff --git a/inventory-gov/src/main/java/com/rzyc/controller/DataController.java b/inventory-gov/src/main/java/com/rzyc/controller/DataController.java index 898b55e..85c19f7 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/DataController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/DataController.java @@ -19,6 +19,7 @@ import com.rzyc.model.organization.OrgDanger; import com.rzyc.model.user.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.beanutils.BeanUtils; import org.apache.poi.ss.usermodel.*; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -34,545 +35,6 @@ import java.util.*; @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 importAreaUser(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult 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 importAreaEnt(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult 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 userDutyTree(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult 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 entDutyTree(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult 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 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 handleFactor()throws Exception{ - SingleResult 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 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 handleDanger()throws Exception{ - SingleResult result = new SingleResult<>(); - - - List 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 addTemp()throws Exception{ - SingleResult 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; - } - /** * 修改密码 * @version v1.0 @@ -1217,4 +679,43 @@ public class DataController extends com.rzyc.controller.BaseController { return result; } + /** + * 年度履职清单迁移 + * @version v1.0 + * @author dong + * @date 2023/12/25 14:37 + */ + @ApiOperation(value = "年度履职清单迁移", notes = "年度履职清单迁移") + @RequestMapping(value = "/listMigrate", method = RequestMethod.GET) + @ResponseBody + public SingleResult listMigrate(Integer year)throws Exception{ + SingleResult result = new SingleResult<>(); + String userId = "系统自动处理"; + List factors = listFactorMapper.findAllByYear(year+""); + Integer nowYear = year + 1; + for (ListFactor listFactor : factors){ + System.out.println("履职清单内容 ---> "+listFactor.getFactorcnt()); + + + // + ListFactor factor = new ListFactor(); + factor = listFactor; + + factor.setListfactorid(RandomNumber.getUUid()); + factor.setCreatedby(userId); + factor.setCreatedon(new Date()); + factor.setModifiedby(userId); + factor.setModifiedon(new Date()); + factor.setSysyear(nowYear+""); + listFactorMapper.insert(factor); + + //添加任务 + addFactorTask(factor,userId); + + listPerformMapper.changeCompletion(factor.getListperformid(),"0"); + + } + return result; + } + } diff --git a/inventory-gov/src/main/java/com/rzyc/controller/DeleteController.java b/inventory-gov/src/main/java/com/rzyc/controller/DeleteController.java deleted file mode 100644 index a5c78f1..0000000 --- a/inventory-gov/src/main/java/com/rzyc/controller/DeleteController.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.rzyc.controller; - -import com.common.utils.RandomNumber; -import com.common.utils.StringUtils; -import com.common.utils.model.MultiResult; -import com.common.utils.model.SingleResult; -import com.rzyc.bean.task.dto.AddTaskDto; -import com.rzyc.bean.task.dto.IdDto; -import com.rzyc.bean.task.vo.ThingVo; -import com.rzyc.model.OADistribution; -import com.rzyc.model.OATask; -import com.rzyc.model.task.dto.TaskAddOrUpdateDto; -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.apache.commons.beanutils.ConvertUtils; -import org.apache.commons.beanutils.converters.DateConverter; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.Date; -import java.util.List; - -/** - * @ClassName: TaskController - * @description: - * @author: ZQW - * * @create: 2022-09-20 15:21 - **/ - -@Api(tags = "可删除控制层") -@CrossOrigin("*") -@RequestMapping("delete") -@RestController -@Validated -public class DeleteController extends BaseController{ - - - /** - * @return: 新增任务执行情况 - * @Author: ZQW - * @Date: 2022/9/20 - */ - @ApiOperation(value = "新增任务执行情况",position = 10) - @PostMapping() - public SingleResult addTask(@Valid TaskAddOrUpdateDto addTaskDto) throws Exception{ - SingleResult result = new SingleResult<>(); - OADistribution oaDistribution = new OADistribution(); - BeanUtils.copyProperties(oaDistribution,addTaskDto); - //日期格式转换 - ConvertUtils.register(new DateConverter(null), Date.class); - - SysUser sysUser = sysUserMapper.selectByPrimaryKey(addTaskDto.getSysuserid()); - if(null == sysUser){ - result.setCode(0); - result.setMessage("用户不存在"); - return result; - } - - if(StringUtils.isBlank(addTaskDto.getOadistributionid())){ - oaDistribution.setOadistributionid(RandomNumber.getUUid()); - oaDistribution.setSyschinaname(sysUser.getChinaname()); - oaDistribution.setSystelephone(sysUser.getMobiletel()); - oaDistribution.setCreatedby(getChinaName()); - oaDistribution.setCreatedon(new Date()); - oaDistributionMapper.insert(oaDistribution); - }else { - oaDistribution.setModifiedby(getChinaName()); - oaDistribution.setModifiedon(new Date()); - oaDistributionMapper.updateById(oaDistribution); - } - - return result; - } - - /** - * @return: 查询任务 - * @Author: ZQW - * @Date: 2022/9/20 - */ - @ApiOperation(value = "查询我发布的任务",position = 2) - @ApiImplicitParams(value = { - @ApiImplicitParam(name = "id",value = "指派用户id") - }) - @GetMapping("deliverTaskList") - public MultiResult deliverTaskList(@Valid IdDto idDto){ - MultiResult result = new MultiResult<>(); - List oaTasks = oaDistributionMapper.deliverTaskList("%%",idDto.getId()); - if(oaTasks != null){ - result.setData(oaTasks); - } - - return result; - } - - /** - * @Description: 查询我收到的任务 - * @Author ZQW - * @CreateTime 2022/9/26 9:34 - */ - @ApiOperation(value = "查询我收到的任务",position = 3) - @ApiImplicitParams(value = { - @ApiImplicitParam(name = "id",value = "接收用户id") - }) - @GetMapping("getTaskList") - public MultiResult getTaskList(@Valid IdDto idDto){ - MultiResult result = new MultiResult<>(); - List oaTasks = oaDistributionMapper.getTaskList("%%",idDto.getId()); - if(oaTasks != null){ - result.setData(oaTasks); - } - return result; - } - - /** - * @return: 查询任务 - * @Author: ZQW - * @Date: 2022/9/20 - */ - @ApiOperation(value = "查询任务",position = 10) - @GetMapping("taskList") - public MultiResult taskList(){ - MultiResult result = new MultiResult<>(); - List oaTasks = oaTaskMapper.taskList("%%"); - result.setData(oaTasks); - return result; - } - - - - - - -} diff --git a/inventory-gov/src/main/java/com/rzyc/controller/DynamicController.java b/inventory-gov/src/main/java/com/rzyc/controller/DynamicController.java deleted file mode 100644 index 2d0337d..0000000 --- a/inventory-gov/src/main/java/com/rzyc/controller/DynamicController.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.rzyc.controller; - -import com.common.utils.DateUtils; -import com.common.utils.TypeConversion; -import com.common.utils.model.*; -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import com.rzyc.advice.LoginAuth; -import com.rzyc.bean.dynamic.DynamicPageDto; -import com.rzyc.bean.dynamic.dto.ChangeDynamicDto; -import com.rzyc.enums.DelState; -import com.rzyc.model.Dynamic; -import com.rzyc.model.NewsClass; -import com.rzyc.model.NewsCnt; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -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.validation.Valid; -import java.util.Date; -import java.util.List; - -@Api(tags = "动态") -@CrossOrigin("*") -@RequestMapping("dynamic") -@Controller -@Validated -public class DynamicController extends com.rzyc.controller.BaseController { - - - /** - * 动态分页 - * @return< - * @throws Exception - */ - @ApiOperation(value = "动态分页", notes = "动态分页") - @PostMapping("/dynamicPage") - @ResponseBody - @LoginAuth - public SingleResult> dynamicPage(@Valid DynamicPageDto dynamicPageDto)throws Exception{ - SingleResult> result = new SingleResult<>(); - String condition = TypeConversion.getCondition(dynamicPageDto.getCondition()); - PageHelper.startPage(dynamicPageDto.getPage(), dynamicPageDto.getPageSize()); - Page page = (Page)newsCntMapper.newsCntList(dynamicPageDto.getNewsClassId(),condition); - Pager pager = new Pager<>(); - getDatePage(pager,page); - if(pager.getRows().size() > 0){ - for (Dynamic dynamic : pager.getRows()){ - handleDynamic(dynamic); - } - } - result.setData(pager); - return result; - } - - /** - * 动态分类列表 - * @return - * @throws Exception - */ - @ApiOperation(value = "动态分类列表", notes = "动态分类列表") - @PostMapping("/newsClassList") - @ResponseBody - @LoginAuth - public MultiResult newsClassList()throws Exception{ - MultiResult result = new MultiResult<>(); - List newsClasses = newsClassMapper.findAll(); - if(newsClasses.size() > 0){ - result.setData(newsClasses); - }else{ - result.setCode(Code.NO_DATA.getCode()); - result.setMessage(Message.NO_DATA); - } - return result; - } - - /** - * 动态详情 - * @return - * @throws Exception - */ - @ApiOperation(value = "动态详情", notes = "动态详情") - @ApiImplicitParam(name = "dynamicId",value = "动态id") - @PostMapping("/dynamicDetail/{dynamicId}") - @ResponseBody - @LoginAuth - public SingleResult dynamicDetail(@PathVariable String dynamicId)throws Exception{ - SingleResult result = new SingleResult<>(); - - NewsCnt newsCnt = newsCntMapper.findById(dynamicId); - if(null != newsCnt){ -// newsCnt.setCoverImage(setServiceFile(newsCnt.getCoverImage())); - result.setData(newsCnt); - }else{ - result.setCode(Code.NO_DATA.getCode()); - result.setMessage(Message.NO_DATA); - } - - /*Dynamic dynamic = newsCntMapper.newCntDetail(dynamicId); - if(null != dynamic){ - handleDynamic(dynamic); - result.setData(dynamic); - }else{ - result.setCode(Code.NO_DATA.getCode()); - result.setMessage(Message.NO_DATA); - }*/ - return result; - } - - /** - * 修改新增动态 - * @return - * @throws Exception - */ - @ApiOperation(value = "修改新增动态", notes = "修改新增动态") - @PostMapping("changeDynamic") - @ResponseBody - @LoginAuth - public SingleResult changeDynamic(@Valid @RequestBody ChangeDynamicDto changeDynamicDto)throws Exception{ - SingleResult result = new SingleResult<>(); - NewsCnt newsCnt = new NewsCnt(); - BeanUtils.copyProperties(newsCnt,changeDynamicDto); - - //操作人 - String chinaName = getChinaName(); - newsCnt.setModifiedby(chinaName); - newsCnt.setCreatedby(chinaName); - newsCnt.setModifiedon(new Date()); - newsCnt.setCreatedon(new Date()); - newsCnt.setDelState(DelState.NOT_DEL.getState()); - - //封面图 -// newsCnt.setCoverImage(delServiceFile(changeDynamicDto.getShowImageUrl())); - newsCnt.setCoverImage(changeDynamicDto.getShowImageUrl()); - - newsCnt.setPublictime(DateUtils.parseString2Date(changeDynamicDto.getPublicTime(),"yyyy-MM-dd HH:mm")); - - Dynamic dynamic = newsCntMapper.newCntDetail(newsCnt.getNewscntid()); - if(null != dynamic){ - //修改 - newsCntMapper.changeNews(newsCnt); - }else{ - //新增 - newsCntMapper.insert(newsCnt); - } - - return result; - } - - /** - * 删除动态 - * @param dynamicId - * @return - * @throws Exception - */ - @ApiOperation(value = "删除动态", notes = "删除动态") - @ApiImplicitParam(name = "dynamicId",value = "动态id 多个逗号隔开",required = true) - @PostMapping("delNewsCnt") - @ResponseBody - @LoginAuth - public SingleResult delNewsCnt(String dynamicId)throws Exception{ - SingleResult result = new SingleResult<>(); - String[] strs = dynamicId.split(","); - //操作人 - String chinaName = getChinaName(); - if(strs.length > 0){ - for (String str : strs){ - NewsCnt newsCnt = newsCntMapper.findById(str); - if(null != newsCnt){ - newsCntMapper.delNewsCnt(newsCnt.getNewscntid(),chinaName); - } - } - } - return result; - } - -} diff --git a/inventory-gov/src/main/java/com/rzyc/controller/ImportController.java b/inventory-gov/src/main/java/com/rzyc/controller/ImportController.java index 24ad5fc..a42733b 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/ImportController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/ImportController.java @@ -38,12 +38,6 @@ import java.util.*; public class ImportController extends com.rzyc.controller.BaseController { - //区id - protected String DISTRICT_ID = "510114"; - - //街道id - protected String STREET = "510114102000"; - private PcBusinessService pcBusinessService; @Autowired @@ -51,2940 +45,6 @@ public class ImportController extends com.rzyc.controller.BaseController { this.pcBusinessService = pcBusinessService; } - /** - * 导入应急避难场所 - * @param file - * @return - */ - @ApiOperation(value = "导入应急避难场所", notes = "导入应急避难场所") - @RequestMapping(value = "/uploadRefuge", method = RequestMethod.POST) - @ResponseBody - public String uploadRefuge(@RequestBody MultipartFile file) { - - try { - List othRefuges = this.getOthRefuges(file); - System.out.println("othRefuges - > "+JSONArray.toJSONString(othRefuges)); - if(null != othRefuges && othRefuges.size() > 0){ - for (OthRefuge othRefuge : othRefuges){ - othRefugeMapper.insert(othRefuge); - } - } - - }catch (Exception e){ - e.printStackTrace(); - } - return "resultMap"; - } - - /** - * 导入应急值守 - * @param file - * @return - */ - @ApiOperation(value = "导入应急值守", notes = "导入应急值守") - @PostMapping(value = "/uploadDuty") - @ResponseBody - public SingleResult uploadDuty(@RequestBody MultipartFile file) { - Listexception = new ArrayList<>(); - SingleResult singleResult = new SingleResult(); - try { - Map govDutyPerson = this.getGovDutyPerson(file); - ListgovDutyPersonList = ( List) govDutyPerson.get("govDutyPerson"); - exception = ( List) govDutyPerson.get("exception"); - govDutyPerson.get("exception"); - System.out.println("govDutyPerson - > "+JSONArray.toJSONString(govDutyPerson)); - if(null != govDutyPerson && govDutyPerson.size() > 0){ - for (GovDutyPerson g: govDutyPersonList){ - govDutyPersonMapper.insert(g); - } - } - singleResult.setData(exception); - }catch (Exception e){ - e.printStackTrace(); - } - return singleResult; - } - - public MapgetGovDutyPerson(MultipartFile multipartFile) throws IOException { - List govDutyPersonList = new ArrayList<>(); - ListexceptionCollection = new ArrayList<>(); - 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(rowHead.getPhysicalNumberOfCells() == 9){ - //获得数据的总行数 - int totalRowNum = sheet.getLastRowNum(); - - if(totalRowNum > 0){ - - Boolean isSubject = true; - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - - int index = i+1; - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - GovDutyPerson govDutyPerson = new GovDutyPerson(); - govDutyPerson.setGovdutypersonid(RandomNumber.getUUid()); - govDutyPerson.setCreatedby("excel"); - govDutyPerson.setCreatedon(new Date()); - govDutyPerson.setModifiedby("excel"); - govDutyPerson.setModifiedon(new Date()); - - //履职日期 - Cell cell = row.getCell((short)0); - if(null != cell){ - Date dutyDay = cell.getDateCellValue(); - if(null != dutyDay){ - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - String dutyTime = dateFormat.format(dutyDay); - govDutyPerson.setDutyday(dutyTime); - }else { - exceptionCollection.add("第"+index+"行数据不合格,最少需要一个值班日期,已剔除"); - continue; - } - }else { - exceptionCollection.add("第"+index+"行数据不合格,最少需要一个值班日期,已剔除"); - continue; - } - - //值班领导 - cell = row.getCell((short)1); - if(null != cell){ - String dutyLeader = dataFormatter.formatCellValue(cell); - if(StringUtils.isNotBlank(dutyLeader)){ - govDutyPerson.setDutyleader(dutyLeader); - } - } - - //值班领导电话 - cell = row.getCell((short)2); - if(null != cell){ - String dutyLeaderPhone = dataFormatter.formatCellValue(cell); - if(StringUtils.isNotBlank(dutyLeaderPhone)){ - govDutyPerson.setLeadermobile(dutyLeaderPhone); - } - } - - - //值班主任 - cell = row.getCell((short)3); - if(null != cell){ - String dutyDirector = dataFormatter.formatCellValue(cell); - if(StringUtils.isNotBlank(dutyDirector)){ - govDutyPerson.setDutydirector(dutyDirector); - } - } - - - //值班主任导电话 - cell = row.getCell((short)4); - if(null != cell){ - String dutyDirectorPhone = dataFormatter.formatCellValue(cell); - if(StringUtils.isNotBlank(dutyDirectorPhone)){ - govDutyPerson.setDirectormobile(dutyDirectorPhone); - } - } - - - //值班人员一 - cell = row.getCell((short)5); - if(null != cell){ - String dutyFirstPerson = dataFormatter.formatCellValue(cell); - if(StringUtils.isNotBlank(dutyFirstPerson)){ - govDutyPerson.setFirstperson(dutyFirstPerson); - } - } - - //值班人员一电话 - cell = row.getCell((short)6); - if(null != cell){ - String dutyFirstPersonPhone = dataFormatter.formatCellValue(cell); - if(StringUtils.isNotBlank(dutyFirstPersonPhone)){ - govDutyPerson.setFirstmobile(dutyFirstPersonPhone); - } - } - - - //值班人员一 - cell = row.getCell((short)7); - if(null != cell){ - String dutySecondPerson = dataFormatter.formatCellValue(cell); - if(StringUtils.isNotBlank(dutySecondPerson)){ - govDutyPerson.setSecondperson(dutySecondPerson); - } - } - - - //值班人员一电话 - cell = row.getCell((short)8); - if(null != cell){ - String dutySecondPersonPhone = dataFormatter.formatCellValue(cell); - if(StringUtils.isNotBlank(dutySecondPersonPhone)){ - govDutyPerson.setSecondmobile(dutySecondPersonPhone); - } - } - govDutyPersonList.add(govDutyPerson); - - } - - } - }else { - exceptionCollection.add("表头列数不正确"); - } - } - System.out.println("数据解析完成"); - Mapmap = new HashMap<>(); - exceptionCollection.add("如果提示已剔除,请检查数据是否为空,为空可忽略"); - map.put("exception",exceptionCollection); - map.put("govDutyPerson",govDutyPersonList); - return map; - } - - - /** - * 解析excel 数据 - * @param multipartFile - * @return - * @throws Exception - */ - public List getOthRefuges(MultipartFile multipartFile)throws Exception{ - List othRefuges = new ArrayList<>(); - - - - if(null != multipartFile){ - 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; - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - OthRefuge othRefuge = new OthRefuge(); - othRefuge.setOthrefugeid(RandomNumber.getUUid()); - othRefuge.setCreatedby("excel"); - othRefuge.setCreatedon(new Date()); - othRefuge.setModifiedby("excel"); - othRefuge.setModifiedon(new Date()); - - //避难场所名 - Cell cell = row.getCell((short)0); - if(null != cell){ - String name = cell.getStringCellValue().toString(); - if(StringUtils.isNotBlank(name)){ - othRefuge.setName(name); - } - } - - //经度 - cell = row.getCell((short)1); - if(null != cell){ - DataFormatter formatter = new DataFormatter(); - String lon = formatter.formatCellValue(cell); - if(StringUtils.isNotBlank(lon)){ - othRefuge.setLng(TypeConversion.StringToDouble(lon)); - } - } - - //纬度 - cell = row.getCell((short)2); - if(null != cell){ - DataFormatter formatter = new DataFormatter(); - String lat = formatter.formatCellValue(cell); - if(StringUtils.isNotBlank(lat)){ - othRefuge.setLat(TypeConversion.StringToDouble(lat)); - } - } - - - //地址 - cell = row.getCell((short)3); - if(null != cell){ - String address = cell.getStringCellValue().toString(); - if(StringUtils.isNotBlank(address)){ - othRefuge.setAddress(address); - } - } - - - //面积 - cell = row.getCell((short)4); - if(null != cell){ - DataFormatter formatter = new DataFormatter(); - String space = formatter.formatCellValue(cell); - if(StringUtils.isNotBlank(space)){ - othRefuge.setSpace(TypeConversion.StringToDouble(space)); - } - } - - - //维护单位 - cell = row.getCell((short)5); - if(null != cell){ - String maintainunit = cell.getStringCellValue().toString(); - if(StringUtils.isNotBlank(maintainunit)){ - othRefuge.setMaintainunit(maintainunit); - } - } - - - - othRefuges.add(othRefuge); - - } - - } - } - } - System.out.println("数据解析完成"); - - return othRefuges; - } - - /** - * 处理二维码 - * @return - * @throws Exception - */ - @ApiOperation(value = "处理二维码", notes = "处理二维码") - @GetMapping("handleQrCode") - @ResponseBody - public SingleResult handleQrCode()throws Exception{ - SingleResult result = new SingleResult<>(); - List enterprises = sysEnterpriseMapper.findByQrCode(); - if(enterprises.size() > 0 ){ - for (SysEnterprise enterprise : enterprises){ - if(StringUtils.isBlank(enterprise.getQrCode())){ - String qrcodeUrl = entQrCode(enterprise.getSysenterpriseid()); - sysEnterpriseMapper.changeQrCode(enterprise.getSysenterpriseid(),qrcodeUrl); - } - } - } - return result; - } - - /** - * 导入最小工作单元检查项 - * @param file - * @return - */ - @ApiOperation(value = "导入最小工作单元检查项", notes = "导入最小工作单元检查项") - @PostMapping(value = "/uploadCheckItem") - @ResponseBody - public SingleResult uploadCheckItem(@RequestBody MultipartFile file) throws Exception{ - SingleResult result = new SingleResult<>(); - handleCheckItem(file); - return result; - } - - public void handleCheckItem(MultipartFile multipartFile) throws IOException { - if(null != multipartFile){ - Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream()); - Sheet sheet = wookbook.getSheetAt(0); - DataFormatter dataFormatter = new DataFormatter(); - //获得表头 - Row rowHead = sheet.getRow(0); - - //判断表头是否正确 - if(true){ - //获得数据的总行数 - int totalRowNum = sheet.getLastRowNum(); - - if(totalRowNum > 0){ - - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - - int index = i+1; - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - String inName = ""; - String safeName = ""; - String checkItem = ""; - String riskLevel = ""; - - //行业 - Cell cell = row.getCell((short)0); - if(null != cell){ - inName = dataFormatter.formatCellValue(cell); - } - - //安全类别 - cell = row.getCell((short)1); - if(null != cell){ - safeName = dataFormatter.formatCellValue(cell); - } - - //检查项 - cell = row.getCell((short)2); - if(null != cell){ - checkItem = dataFormatter.formatCellValue(cell); - } - - //隐患等级 - cell = row.getCell((short)3); - if(null != cell){ - riskLevel = dataFormatter.formatCellValue(cell); - } - - - - ChkBillDetailWithBLOBs chkBillDetail = new ChkBillDetailWithBLOBs(); - - chkBillDetail.setChkbilldetailid(RandomNumber.getUUid()); - List inClasses = baseInClassMapper.findByName(inName); - if(inClasses.size() > 0){ - chkBillDetail.setBaseinclassid(inClasses.get(0).getBaseinclassid()); - } - - List safeClasses = baseSafeClassMapper.findByName(safeName); - if(safeClasses.size() > 0){ - chkBillDetail.setBasesafeclassid(safeClasses.get(0).getBasesafeclassid()); - } - - chkBillDetail.setCheckobjectname(checkItem); - chkBillDetail.setHiddenDanger(riskLevel); - chkBillDetail.setCreatedby("excel"); - chkBillDetail.setCreatedon(new Date()); - chkBillDetail.setModifiedby("excel"); - chkBillDetail.setModifiedon(new Date()); - chkBillDetailMapper.insert(chkBillDetail); - - } - - } - } - } - } - - /** - * 导入企业 - * @param file - * @return - * */ - @ApiOperation(value = "导入企业", notes = "导入企业") - @PostMapping(value = "/importCompany") - @ApiImplicitParams({ - @ApiImplicitParam(name = "userName", value = "用户账号", required = true, dataType = "string"), - }) - @ResponseBody - public SingleResult importCompany(@RequestBody MultipartFile file,String userName) throws Exception{ - SingleResult singleResult = new SingleResult(); - this.importCompanies(file,userName); - return singleResult; - } - - private int importCompanies(MultipartFile multipartFile,String userName) throws Exception { - SysUser sysUser = sysUserMapper.selectAdmin(userName); - int result = 0; - if(null != multipartFile){ - Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream()); - Sheet sheet = wookbook.getSheetAt(0); - DataFormatter dataFormatter = new DataFormatter(); - //获得表头 - Row rowHead = sheet.getRow(0); - - Listlist = new ArrayList<>(); - - //判断表头是否正确 - if(true){ - //获得数据的总行数 - int totalRowNum = sheet.getLastRowNum(); - - if(totalRowNum > 0){ - - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - SysEnterprise sysEnterprise = new SysEnterprise(); - int index = i+1; - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - //企业名称 - Cell cell = row.getCell((short)0); - if(null != cell){ - String companyName = dataFormatter.formatCellValue(cell); - sysEnterprise.setEntname(companyName); - } - - //所属区域 - cell = row.getCell((short)1); - if(null != cell){ - String orgCode = dataFormatter.formatCellValue(cell); - sysEnterprise.setOrgcode(orgCode); - } - - //行业类别 - cell = row.getCell((short)2); - if(null != cell){ - String industryCategory = dataFormatter.formatCellValue(cell); - sysEnterprise.setBaseinclassid(industryCategory); - } - - //安全类别 - cell = row.getCell((short)3); - if(null != cell){ - String safeCategory = dataFormatter.formatCellValue(cell); - sysEnterprise.setBasesafeclassid(safeCategory); - } - - //法人 - cell = row.getCell((short)4); - if(null != cell){ - String legalPerson = dataFormatter.formatCellValue(cell); - sysEnterprise.setLegalrepre(legalPerson); - } - - //法人联系方式 - cell = row.getCell((short)5); - if(null != cell){ - String legalPersonContract = dataFormatter.formatCellValue(cell); - sysEnterprise.setLrlinktel(legalPersonContract); - } - - //地址 - cell = row.getCell((short)6); - if(null != cell){ - String address = dataFormatter.formatCellValue(cell); - sysEnterprise.setSysaddress(address); - } - - //成立日期 - cell = row.getCell((short)7); - if(null != cell){ - String establishTime = dataFormatter.formatCellValue(cell); - sysEnterprise.setEstablishdate(establishTime); - } - - //主管部门 - cell = row.getCell((short)8); - if(null != cell){ - String managerDept = dataFormatter.formatCellValue(cell); - sysEnterprise.setManagerDept(managerDept); - } - - - //是否隐藏 - cell = row.getCell((short)9); - if(null != cell){ - String hide = dataFormatter.formatCellValue(cell); - sysEnterprise.setIsHide(hide); - } - - //状态 - cell = row.getCell((short)10); - if(null != cell){ - String state = dataFormatter.formatCellValue(cell); - sysEnterprise.setState(state); - } - - //经营范围 - cell = row.getCell((short)11); - if(null != cell){ - String businessScope = dataFormatter.formatCellValue(cell); - sysEnterprise.setManageType(businessScope); - } - - //部门 - cell = row.getCell((short)12); - if(null != cell){ - String sysUnit = dataFormatter.formatCellValue(cell); - if (StringUtils.isBlank(sysUnit)){ - sysUnit = ""; - } - sysEnterprise.setSysUnitId(sysUnit); - } - - //风险等级 - cell = row.getCell((short)13); - if(null != cell){ - String riskLevel = dataFormatter.formatCellValue(cell); - if (null != riskLevel) { - sysEnterprise.setRisklevel(riskLevel); - } - } - - list.add(sysEnterprise); - - } - for (SysEnterprise sys:list) { - sys.setSysenterpriseid(RandomNumber.getUUid()); - sys.setQrCode(entQrCode(sys.getSysenterpriseid())); - List enterprises = sysEnterpriseMapper.findByEntName(sys.getEntname(),""); - if(null == enterprises || enterprises.size() <=0){ - result += sysEnterpriseMapper.insert(sys); - createEntUser(sys,sysUser.getSysuserid(),sysUser); - } - } - } - } - } - return result; - } - - - /** - * 导入地区 - * @param file - * @return - */ - @ApiOperation(value = "导入地区", notes = "导入地区") - @PostMapping(value = "/importArea") - @ResponseBody - public SingleResult importArea(@RequestBody MultipartFile file) throws Exception{ - SingleResult result = new SingleResult<>(); - handleArea(file); - return result; - } - - public void handleArea(MultipartFile multipartFile) throws IOException { - if(null != multipartFile){ - Workbook wookbook = WorkbookFactory.create(multipartFile.getInputStream()); - Sheet sheet = wookbook.getSheetAt(0); - DataFormatter dataFormatter = new DataFormatter(); - //获得表头 - Row rowHead = sheet.getRow(0); - - //判断表头是否正确 - if(true){ - //获得数据的总行数 - int totalRowNum = sheet.getLastRowNum(); - - if(totalRowNum > 0){ - - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - - int index = i+1; - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - String streetName = ""; - String communityName = ""; - - //行业 - Cell cell = row.getCell((short)0); - if(null != cell){ - streetName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)1); - if(null != cell){ - communityName = dataFormatter.formatCellValue(cell); - } - - System.out.println(streetName+"-"+communityName); - - - SysOrg street = sysOrgMapper.findByName(streetName,""); - if(null != street){ - SysOrg community = sysOrgMapper.findByName(communityName,street.getOrgcode()); - if(null == community){ - community = new SysOrg(); - community.setOrgcode(RandomNumber.getUUid()); - community.setOrgname(communityName); - community.setOrglevel(4); - community.setSuperiororgcode(street.getOrgcode()); - community.setCreatedby("excel"); - community.setCreatedon(new Date()); - community.setModifiedby("excel"); - community.setModifiedon(new Date()); - sysOrgMapper.insert(community); - } - } - - - } - - } - } - } - } - - @ApiOperation(value = "街道导入岗位用户", notes = "街道导入岗位用户") - @RequestMapping(value = "/importUser", method = RequestMethod.POST) - @ResponseBody - public SingleResult importUser(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult result = new SingleResult<>(); - handleUser(multipartFile); - return result; - } - - public void handleUser(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; - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - - int index = i+1; - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - String streetName = ""; - String deptName = ""; - String postName = ""; - String userName = ""; - String chinaName = ""; - - - Cell cell = row.getCell((short)0); - if(null != cell){ - streetName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)1); - if(null != cell){ - deptName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)2); - if(null != cell){ - postName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)3); - if(null != cell){ - userName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)4); - if(null != cell){ - chinaName = dataFormatter.formatCellValue(cell); - } - - streetName = StringUtils.replaceBlank(streetName); - deptName = StringUtils.replaceBlank(deptName); - postName = StringUtils.replaceBlank(postName); - userName = StringUtils.replaceBlank(userName); - chinaName = StringUtils.replaceBlank(chinaName); - - System.out.println(streetName+"-"+deptName+"-"+postName+"-"+userName+"-"+chinaName); - - -// //处理部门 - SysUnit sysUnit = getSysUnit(streetName,deptName); - System.out.println("sysUnit -> "+sysUnit.getSysunitid()); -// -// - ListPerform perform = handlePostNew(streetName,deptName,postName,chinaName); - System.out.println("perform -> "+perform.getListperformid()); - - - - SysUser sysUser = sysUserMapper.findBySysUserName(userName); - if(null == sysUser){ - sysUser = new SysUser(); - sysUser.setSysuserid(RandomNumber.getUUid()); - sysUser.setUsertype("政府用户"); - - //区id - sysUser.setOrgcode(DISTRICT_ID); - - //街道id - String streetCode = ""; - SysOrg streetOrg = sysOrgMapper.findByName(streetName,DISTRICT_ID); - if(null != streetOrg){ - streetCode = streetOrg.getOrgcode(); - } - sysUser.setStreetCode(streetCode); - - //社区id - SysOrg community = sysOrgMapper.findByName(deptName,streetCode); - if(null != community){ - sysUser.setCommunityCode(community.getOrgcode()); - } - - - sysUser.setSysunitorentid(sysUnit.getSysunitid()); - sysUser.setSysusername(userName); - sysUser.setChinaname(chinaName); - sysUser.setMobiletel(userName); - String passwd = PasswdFactory.encryptPasswd(sysUser.getSysuserid(), sysUser.getSysusername(), constantsConfigure.getDefaultPasswd()); - sysUser.setSyspassword(passwd); - sysUser.setUserroles("295EF8C3-902F-41F0-95C8-D3AB9C6DA145"); - sysUser.setSystitle(perform.getListperformid()); - sysUser.setState("启用"); - sysUser.setCreatedby("导入"); - sysUser.setModifiedby("导入"); - sysUser.setCreatedon(new Date()); - sysUser.setModifiedon(new Date()); - sysUserMapper.insert(sysUser); - }else{ - - //区id - sysUser.setOrgcode(DISTRICT_ID); - - //街道id - sysUser.setStreetCode(STREET); - - //社区id - SysOrg community = sysOrgMapper.findByName(deptName,STREET); - if(null != community){ - sysUser.setCommunityCode(community.getOrgcode()); - } - - sysUser.setMobiletel(userName); - - sysUserMapper.changeMobile(sysUser); - - } - } - - } - } - } - } - - /** - * 岗位 - * @param streetName - * @param deptName - * @param postName - * @return - * @throws Exception - */ - private ListPerform handlePost(String streetName,String deptName,String postName)throws Exception{ - ListPerform perform = new ListPerform(); - //区岗位id - String districtPerformId = "669dcdbd-aabd-44f7-b035-003c042f9e06"; - - ListPerform streetPerform = listPerformMapper.findByName(streetName,districtPerformId); - if(null != streetPerform){ - ListPerform communityPerform = listPerformMapper.findByName(deptName,streetPerform.getListperformid()); - if(null == communityPerform){ - communityPerform = new ListPerform(); - communityPerform.setListperformid(RandomNumber.getUUid()); - communityPerform.setPerformclassname(deptName); - communityPerform.setSortid(150); - communityPerform.setSupclassid(streetPerform.getListperformid()); - communityPerform.setCreatedby("导入"); - communityPerform.setModifiedby("导入"); - communityPerform.setCreatedon(new Date()); - communityPerform.setModifiedon(new Date()); - listPerformMapper.insert(communityPerform); - } - perform = listPerformMapper.findByName(postName,communityPerform.getListperformid()); - if(null == perform){ - perform = new ListPerform(); - perform.setListperformid(RandomNumber.getUUid()); - perform.setPerformclassname(postName); - perform.setSortid(350); - perform.setSupclassid(communityPerform.getListperformid()); - perform.setCreatedby("导入"); - perform.setModifiedby("导入"); - perform.setCreatedon(new Date()); - perform.setModifiedon(new Date()); - listPerformMapper.insert(perform); - } - } - return perform; - } - - /** - * 岗位 - * @param streetName - * @param deptName - * @param postName - * @return - * @throws Exception - */ - private ListPerform handlePostNew(String streetName,String deptName,String postName,String chinaName)throws Exception{ - ListPerform perform = new ListPerform(); - //区岗位id - String districtPerformId = "669dcdbd-aabd-44f7-b035-003c042f9e06"; - - ListPerform streetPerform = listPerformMapper.findByName(streetName,districtPerformId); - if(null != streetPerform){ - ListPerform communityPerform = listPerformMapper.findByName(deptName,streetPerform.getListperformid()); - if(null == communityPerform){ - communityPerform = new ListPerform(); - communityPerform.setListperformid(RandomNumber.getUUid()); - communityPerform.setPerformclassname(deptName); - communityPerform.setSortid(150); - communityPerform.setSupclassid(streetPerform.getListperformid()); - communityPerform.setCreatedby("导入"); - communityPerform.setModifiedby("导入"); - communityPerform.setCreatedon(new Date()); - communityPerform.setModifiedon(new Date()); - listPerformMapper.insert(communityPerform); - } -// perform = listPerformMapper.findByName(postName,communityPerform.getListperformid()); -// if(null == perform){ -// -// } - - perform = new ListPerform(); - perform.setListperformid(RandomNumber.getUUid()); - perform.setPerformclassname(postName); - perform.setPerformName(chinaName); - perform.setSortid(350); - perform.setSupclassid(communityPerform.getListperformid()); - perform.setCreatedby("导入"); - perform.setModifiedby("导入"); - perform.setCreatedon(new Date()); - perform.setModifiedon(new Date()); - listPerformMapper.insert(perform); - } - return perform; - } - - /** - * 部门 - * @param streetName - * @param deptName - * @return - * @throws Exception - */ - public SysUnit getSysUnit(String streetName,String deptName)throws Exception{ - SysUnit sysUnit = null; - //区地区id - - //区部门id - String districtUnitId = "fe4a2834-c754-4ed1-97db-4914c822d820"; - - String streetCode = ""; - // - SysOrg sysOrg = sysOrgMapper.findByName(streetName,"510114"); - if(null != sysOrg){ - streetCode = sysOrg.getOrgcode(); - } - - //查询街道办部门信息 - SysUnit streetUnit = sysUnitMapper.findByUnitName(streetName,districtUnitId); - if(null != streetUnit){ - - //查询部门是否存在 不存在就新增 - sysUnit = sysUnitMapper.findByUnitName(deptName,streetUnit.getSysunitid()); - if(null == sysUnit){ - sysUnit = new SysUnit(); - sysUnit.setSysunitid(RandomNumber.getUUid()); - sysUnit.setOrgcode(streetCode); - sysUnit.setUnittype(UnitType.AREA.getType()+""); - sysUnit.setSuperiorunitid(streetUnit.getSysunitid()); - sysUnit.setUnitname(deptName); - sysUnit.setCreatedby("导入"); - sysUnit.setModifiedby("导入"); - sysUnit.setCreatedon(new Date()); - sysUnit.setModifiedon(new Date()); - sysUnitMapper.insert(sysUnit); - } - } - return sysUnit; - } - - - /** - * 创建企业用户,创建时间为null的企业,并把企业创建时间改为今天,传一个用户账号,作为导入人 - * @return - * @throws Exception - */ - @ApiOperation(value = "创建企业用户,创建时间为null的企业,并把企业创建时间改为今天", notes = "创建企业用户,创建时间为null的企业,并把企业创建时间改为今天") - @PostMapping(value = "/createCompanyUserByCreateOnIsNull") - @ResponseBody - public SingleResult createCompanyUserByCreateOnIsNull(String userName){ - SingleResult singleResult = new SingleResult(); - ListsysEnterpriseList = sysEnterpriseMapper.selectCreateOnIsNull(); - SysUser sysUser = sysUserMapper.selectAdmin(userName); - if (null != sysEnterpriseList ){ - for (SysEnterprise se:sysEnterpriseList) { - createEntUser(se,sysUser.getSysuserid(),sysUser); - } - } - singleResult.setMessage("成功修改"+sysEnterpriseList.size()+"家企业"); - return singleResult; - } - - @ApiOperation(value = "街道导入企业", notes = "街道导入企业") - @RequestMapping(value = "/importEnts", method = RequestMethod.POST) - @ResponseBody - private SingleResult importEnts(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult result = new SingleResult<>(); - handleEnt(multipartFile); - return result; - } - - - public void handleEnt(MultipartFile multipartFile)throws Exception{ - if(null != multipartFile){ - 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(); - - List enterprises = new ArrayList<>(); - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - - String entName = "";//名称 - String addresss = "";//行政区域 - String inClassName = "";//行政区域 - String name = "";//法人名 - String mobile = "";//法人联系方式 - - - //名称 - Cell cell = row.getCell((short)0); - if(null != cell){ - entName = dataFormatter.formatCellValue(cell); - } - - //地址 - cell = row.getCell((short)1); - if(null != cell){ - addresss = dataFormatter.formatCellValue(cell); - } - - //行业 - cell = row.getCell((short)2); - if(null != cell){ - inClassName = dataFormatter.formatCellValue(cell); - } - - //统一信用代码 - cell = row.getCell((short)3); - if(null != cell){ - name = dataFormatter.formatCellValue(cell); - } - - //统一信用代码 - cell = row.getCell((short)4); - if(null != cell){ - mobile = dataFormatter.formatCellValue(cell); - } - - - SysEnterprise enterprise = new SysEnterprise(); - enterprise.setSysenterpriseid(RandomNumber.getUUid()); - enterprise.setEntname(entName); - - //区id - String districtId = "d263c635-beb3-11eb-9d3c-00163e0c1c62"; - enterprise.setOrgcode(districtId); - - - String baseinclassid = ""; - - BaseInClass inClasses = baseInClassMapper.findByNameAndType(inClassName); - if(null != inClasses){ - enterprise.setBaseinclassid(inClasses.getBaseinclassid()); - } - - - enterprise.setComplite("未评级"); - enterprise.setSysaddress(addresss); - enterprise.setSysUnitId(""); - enterprise.setLegalrepre(name); - enterprise.setLrlinktel(mobile); - enterprise.setSafeManager(name); - enterprise.setSafeTelephone(mobile); - enterprise.setLegalrepre(name); - enterprise.setRisklevel("低风险"); - enterprise.setCreatedon(new Date()); - enterprise.setModifiedon(new Date()); - enterprise.setCreatedby("导入"); - enterprise.setModifiedby("导入"); - - - - enterprises.add(enterprise); - - - } - - - if(enterprises.size() > 0){ - Integer index = 1; - for(SysEnterprise enterprise : enterprises) { - /*List companys = sysEnterpriseMapper.findByEntName(enterprise.getEntname(), enterprise.getSysenterpriseid()); - if (null == companys || 0 == companys.size()) { - - - //区id - String districtId = "510114"; - enterprise.setOrgcode(districtId); - - //街道id - String street = "510114102000"; - enterprise.setStreetCode(street); - - sysEnterpriseMapper.insert(enterprise); - System.out.println(enterprise.getSysenterpriseid() + " -> " + enterprise.getEntname()); - createEntUser(enterprise, "管理员"); - }*/ - SysEnterprise sysEnterprise = sysEnterpriseMapper.findByName(enterprise.getEntname()); - if(null != sysEnterprise){ - enterprise.setSysenterpriseid(sysEnterprise.getSysenterpriseid()); - sysEnterpriseMapper.changeInclass(enterprise); - } - index++; - System.out.println("index -> " + index); - } - } - - } - } - } - System.out.println("数据解析完成"); - } - - - - - @ApiOperation(value = "街道导入企业责任树", notes = "街道导入企业责任树") - @RequestMapping(value = "/importEntTree", method = RequestMethod.POST) - @ResponseBody - private SingleResult importEntTree(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult result = new SingleResult<>(); - handleEntTree(multipartFile); - return result; - } - - - public void handleEntTree(MultipartFile multipartFile)throws Exception{ - if(null != multipartFile){ - 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(); - - List enterprises = new ArrayList<>(); - - Map inherentRiskMap = new HashMap<>(); - inherentRiskMap.put("红","4"); - inherentRiskMap.put("橙","3"); - inherentRiskMap.put("黄","2"); - inherentRiskMap.put("蓝","1"); - - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - - String entName = "";//名称 - String addresss = "";//地址 - String communityName = "";//社区 - String inherentRisk = "";//静态风险 - String name = "";//法人名 - String mobile = "";//法人联系方式 - String chargeInfo = "";//负责人信息 - String enttype = "";//使用类型 - String leaderInfo = "";//镇街包片领导 - String cadreInfo = "";//镇街定点干部 - String villageInfo = "";//村社定点干部 - - - - //名称 - Cell cell = row.getCell((short)0); - if(null != cell){ - entName = dataFormatter.formatCellValue(cell); - } - - //地址 - cell = row.getCell((short)1); - if(null != cell){ - addresss = dataFormatter.formatCellValue(cell); - } - - //社区 - cell = row.getCell((short)2); - if(null != cell){ - communityName = dataFormatter.formatCellValue(cell); - } - - //静态风险 - cell = row.getCell((short)3); - if(null != cell){ - inherentRisk = dataFormatter.formatCellValue(cell); - } - - //企业负责人及电话 - cell = row.getCell((short)4); - if(null != cell){ - chargeInfo = dataFormatter.formatCellValue(cell); - } - - //房屋使用类型 - cell = row.getCell((short)5); - if(null != cell){ - enttype = dataFormatter.formatCellValue(cell); - } - - //镇街包片领导 - cell = row.getCell((short)7); - if(null != cell){ - leaderInfo = dataFormatter.formatCellValue(cell); - } - - //镇街定点干部 - cell = row.getCell((short)8); - if(null != cell){ - cadreInfo = dataFormatter.formatCellValue(cell); - } - - //村社定点干部 - cell = row.getCell((short)9); - if(null != cell){ - villageInfo = dataFormatter.formatCellValue(cell); - } - - //处理企业负责人 - Map legalrepreMap = handleNameMobile(chargeInfo); - name = legalrepreMap.get("name"); - mobile = legalrepreMap.get("mobile"); - - - SysEnterprise enterprise = new SysEnterprise(); - enterprise.setSysenterpriseid(RandomNumber.getUUid()); - enterprise.setEntname(entName); - enterprise.setLeaderInfo(leaderInfo); - enterprise.setCadreInfo(cadreInfo); - enterprise.setVillageInfo(villageInfo); - enterprise.setCommunityName(communityName); - - //区id - enterprise.setOrgcode("510114"); - //街道id - enterprise.setStreetCode("510114102000"); - //社区 - enterprise.setCommunityCode(communityName); - //使用类型 - enterprise.setEnttype(enttype); - - - - - - enterprise.setComplite("未评级"); - enterprise.setSysaddress(addresss); - - //静态风险 - if(StringUtils.isNotBlank(inherentRisk)){ - inherentRisk = inherentRiskMap.get(inherentRisk); - }else{ - inherentRisk = 1+""; - } - enterprise.setInherentRisk(inherentRisk); - System.out.println("inherentRisk -> "+inherentRisk); - - - enterprise.setSysUnitId(""); - enterprise.setLegalrepre(name); - enterprise.setLrlinktel(mobile); - System.out.println(name+"-"+mobile); - enterprise.setSafeManager(name); - enterprise.setSafeTelephone(mobile); - enterprise.setLegalrepre(name); - enterprise.setRisklevel("低风险"); - enterprise.setCreatedon(new Date()); - enterprise.setModifiedon(new Date()); - enterprise.setCreatedby("导入"); - enterprise.setModifiedby("导入"); - - - - enterprises.add(enterprise); - - - } - - - if(enterprises.size() > 0){ - Integer index = 1; - for(SysEnterprise enterprise : enterprises) { - - - //更新 - String districtId = "510114"; - enterprise.setOrgcode(districtId); - - //街道id - String street = "510114102000"; - enterprise.setStreetCode(street); - - //社区id - String communityCode = ""; - if(StringUtils.isNotBlank(enterprise.getCommunityCode())){ - SysOrg sysOrg = sysOrgMapper.findByName(enterprise.getCommunityCode(),street); - if(null != sysOrg){ - communityCode = sysOrg.getOrgcode(); - - } - } - enterprise.setCommunityCode(communityCode); - - - SysEnterprise company = sysEnterpriseMapper.findByName(enterprise.getEntname()); - if (null != company) { - enterprise.setSysenterpriseid(company.getSysenterpriseid()); - sysEnterpriseMapper.changeImportEnt(enterprise); - - }else{ - sysEnterpriseMapper.insert(enterprise); - - } - - //镇街包片领导id - String leaderId = ""; - String leaderInfo = enterprise.getLeaderInfo(); - if(StringUtils.isNotBlank(leaderInfo)){ - leaderId = getLeaderId(leaderInfo); - if(StringUtils.isBlank(leaderId)){ - System.out.println("---------------------------"); - System.out.println(enterprise.getEntname()+"-"+leaderInfo); - }else{ - System.out.println("leaderId -> "+leaderId); - } - } - - //镇街定点干部id - String cadreId = ""; - String cadreInfo = enterprise.getCadreInfo(); - if(StringUtils.isNotBlank(cadreInfo)){ - cadreId = getCadreUser(cadreInfo,enterprise.getCommunityName()); - if(StringUtils.isBlank(cadreId)){ - System.out.println("---------------------------"); - System.out.println(enterprise.getEntname()+"-"+cadreInfo); - }else{ - System.out.println("leaderId -> "+cadreId); - } - } - - //领导 干部 责任树 - if(StringUtils.isNotBlank(leaderId) && StringUtils.isNotBlank(cadreId)){ - - DutyTree dutyTree = dutyTreeMapper.findTree(1,leaderId,cadreId); - if(null == dutyTree){ - dutyTree = new DutyTree(); - dutyTree.setDutyTreeId(RandomNumber.getUUid()); - dutyTree.setUserId(leaderId); - dutyTree.setTargetType(1); - dutyTree.setTargetId(cadreId); - dutyTree.setModifyTime(new Date()); - dutyTree.setCreateTime(new Date()); - dutyTree.setCreated("导入"); - dutyTree.setCreated("导入"); - dutyTreeMapper.insert(dutyTree); - } - - } - - //村社定点干部id - String villageId = ""; - String villageInfo = enterprise.getVillageInfo(); - if(StringUtils.isNotBlank(villageInfo)){ - villageId = getVillageUser(villageInfo,enterprise.getCommunityCode(),enterprise.getCommunityName()); - if(StringUtils.isBlank(villageId)){ - System.out.println("---------------------------"); - System.out.println(enterprise.getEntname()+"-"+villageInfo); - }else{ - System.out.println("leaderId -> "+villageId); - } - } - //干部 村 责任树 - if(StringUtils.isNotBlank(cadreId) && StringUtils.isNotBlank(villageId)){ - DutyTree dutyTree = dutyTreeMapper.findTree(1,cadreId,villageId); - if(null == dutyTree){ - dutyTree = new DutyTree(); - dutyTree.setDutyTreeId(RandomNumber.getUUid()); - dutyTree.setUserId(cadreId); - dutyTree.setTargetType(1); - dutyTree.setTargetId(villageId); - dutyTree.setModifyTime(new Date()); - dutyTree.setCreateTime(new Date()); - dutyTree.setCreated("导入"); - dutyTree.setCreated("导入"); - dutyTreeMapper.insert(dutyTree); - } - } - - - //村 企业 责任树 - if(StringUtils.isNotBlank(villageId)){ - DutyTree dutyTree = dutyTreeMapper.findTree(2,villageId,enterprise.getSysenterpriseid()); - if(null == dutyTree){ - dutyTree = new DutyTree(); - dutyTree.setDutyTreeId(RandomNumber.getUUid()); - dutyTree.setUserId(villageId); - dutyTree.setTargetType(2); - dutyTree.setTargetId(enterprise.getSysenterpriseid()); - dutyTree.setModifyTime(new Date()); - dutyTree.setCreateTime(new Date()); - dutyTree.setCreated("导入"); - dutyTree.setCreated("导入"); - dutyTreeMapper.insert(dutyTree); - } - } - - - createEntUser(enterprise, "管理员",null); - index++; - System.out.println("index -> " + index); - } - } - - } - } - } - System.out.println("数据解析完成"); - } - - public String getLeaderId(String userInfo)throws Exception{ - String userId = ""; - Map userMap = handleNameMobile(userInfo); - String name = userMap.get("name"); - String mobile = userMap.get("mobile"); - if(StringUtils.isBlank(mobile)){ - mobile = name; - } - SysUser sysUser = sysUserMapper.findByUser(name,mobile); - if(null != sysUser){ - userId = sysUser.getSysuserid(); - } - return userId; - } - - /** - * 获取用户信息 - * @return - * @throws Exception - */ - public String getCadreUser(String userInfo,String communityName)throws Exception{ - String userId= ""; - Map userMap = handleNameMobile(userInfo); - String name = userMap.get("name"); - String mobile = userMap.get("mobile"); - if(StringUtils.isBlank(mobile)){ - mobile = name; - } - String streetName = "石板滩街道"; - SysUser sysUser = sysUserMapper.villageUser(mobile); - if(null == sysUser){ - - String postName = "驻村干部"; - - SysUnit sysUnit = getSysUnit(streetName,communityName); - System.out.println("sysUnit -> "+sysUnit.getSysunitid()); -// -// - ListPerform perform = handlePost(streetName,communityName,postName); - System.out.println("perform -> "+perform.getListperformid()); - - sysUser = new SysUser(); - sysUser.setSysuserid(RandomNumber.getUUid()); - sysUser.setUsertype("政府用户"); - - //区id - sysUser.setOrgcode(DISTRICT_ID); - //街道id - sysUser.setStreetCode(STREET); - - sysUser.setSysunitorentid(sysUnit.getSysunitid()); - sysUser.setSysusername(mobile); - sysUser.setChinaname(name); - String passwd = PasswdFactory.encryptPasswd(sysUser.getSysuserid(), sysUser.getSysusername(), constantsConfigure.getDefaultPasswd()); - sysUser.setSyspassword(passwd); - sysUser.setUserroles("295EF8C3-902F-41F0-95C8-D3AB9C6DA145"); - sysUser.setSystitle(perform.getListperformid()); - sysUser.setState("启用"); - sysUser.setCreatedby("导入"); - sysUser.setModifiedby("导入"); - sysUser.setCreatedon(new Date()); - sysUser.setModifiedon(new Date()); - sysUserMapper.insert(sysUser); - } - userId = sysUser.getSysuserid(); - - return userId; - } - - /** - * 获取用户信息 - * @return - * @throws Exception - */ - public String getVillageUser(String userInfo,String communityCode,String communityName)throws Exception{ - String userId= ""; - Map userMap = handleNameMobile(userInfo); - String name = userMap.get("name"); - String mobile = userMap.get("mobile"); - if(StringUtils.isBlank(mobile)){ - mobile = name; - } - String streetName = "石板滩街道"; - SysUser sysUser = sysUserMapper.villageUser(mobile); - if(null == sysUser){ - - String postName = "工作人员"; - - SysUnit sysUnit = getSysUnit(streetName,communityName); - System.out.println("sysUnit -> "+sysUnit.getSysunitid()); -// -// - ListPerform perform = handlePost(streetName,communityName,postName); - System.out.println("perform -> "+perform.getListperformid()); - - sysUser = new SysUser(); - sysUser.setSysuserid(RandomNumber.getUUid()); - sysUser.setUsertype("政府用户"); - - //区id - sysUser.setOrgcode(DISTRICT_ID); - //街道id - sysUser.setStreetCode(STREET); - - //社区id - sysUser.setCommunityCode(communityCode); - - sysUser.setSysunitorentid(sysUnit.getSysunitid()); - sysUser.setSysusername(mobile); - sysUser.setChinaname(name); - String passwd = PasswdFactory.encryptPasswd(sysUser.getSysuserid(), sysUser.getSysusername(), constantsConfigure.getDefaultPasswd()); - sysUser.setSyspassword(passwd); - sysUser.setUserroles("295EF8C3-902F-41F0-95C8-D3AB9C6DA145"); - sysUser.setSystitle(perform.getListperformid()); - sysUser.setState("启用"); - sysUser.setCreatedby("导入"); - sysUser.setModifiedby("导入"); - sysUser.setCreatedon(new Date()); - sysUser.setModifiedon(new Date()); - sysUserMapper.insert(sysUser); - } - - userId = sysUser.getSysuserid(); - - return userId; - } - - - - /** - * 处理用户信息 - * @param userInfo - * @return - * @throws Exception - */ - private Map handleNameMobile(String userInfo)throws Exception{ - Map userMap = new HashMap<>(); - if(StringUtils.isNotBlank(userInfo)){ - String name = ""; - String mobile = ""; - userInfo = userInfo.replaceAll(" ",""); - userInfo = userInfo.replaceAll("\t",""); - userInfo = userInfo.replaceAll("\n",""); - userInfo = userInfo.replaceAll(":",""); - - - if(userInfo.contains("1")){ - Integer oneIndex = StringUtils.getStrPosition(userInfo,"1"); - if(oneIndex>0){ - // - name = userInfo.substring(0,oneIndex); - mobile = userInfo.substring(oneIndex,userInfo.length()); - }else{ - //如果开始为1 则只有电话 - mobile = userInfo; - } - }else{ - //不包含1 则表示没有电话 - name = userInfo; - } - userMap.put("name",name); - userMap.put("mobile",mobile); - } - return userMap; - } - - /** - * 处理最小工作单元 - * @return - * @throws Exception - */ - @ApiOperation(value = "处理最小工作单元", notes = "处理最小工作单元") - @RequestMapping(value = "/handleEntUnit", method = RequestMethod.POST) - @ResponseBody - public SingleResult handleEntUnit()throws Exception{ - SingleResult result = new SingleResult<>(); - List enterprises = sysEnterpriseMapper.findAll(); - for(SysEnterprise enterprise : enterprises){ - List workUnits = minWorkUnitMapper.getByparentIdList(enterprise.getSysenterpriseid()); - if(null == workUnits || 0 == workUnits.size()){ - //生成最小工作单元 - saveEntWork(enterprise.getSysenterpriseid()); - } - } - return result; - } - - /** - * 驻村干部处理 - * @return - * @throws Exception - */ - @ApiOperation(value = "驻村干部处理", notes = "驻村干部处理") - @RequestMapping(value = "/villageUser", method = RequestMethod.POST) - @ResponseBody - public SingleResult villageUser()throws Exception{ - SingleResult result = new SingleResult<>(); - String areaCode = "510114102000";//石板滩街道id - List users = sysUserMapper.allVillageUser(areaCode); - if(users.size() > 0){ - - //石板滩街道岗位id - String superPerformId = "dd6bfbd7-e088-4557-9ade-b7a04b9e868a"; - - //石板滩部门id - String deptId = "d506619b-08b6-416c-aedf-b57d4e221003"; - - for (SysUser user : users){ - String dutyId = user.getSystitle(); - user.setOrgcode(DISTRICT_ID); - user.setStreetCode(STREET); - user.setCommunityCode(""); - - //创建驻村干部岗位 - ListPerform listPerform = new ListPerform(); - listPerform.setListperformid(RandomNumber.getUUid()); - listPerform.setSortid(1000); - listPerform.setPerformclassname("驻村干部"); - listPerform.setPerformName(user.getChinaname()); - listPerform.setSupclassid(superPerformId); - listPerform.setCreatedby("导入"); - listPerform.setCreatedon(new Date()); - listPerform.setModifiedby(""); - listPerform.setModifiedon(new Date()); - listPerformMapper.insert(listPerform); - - - //岗位id - user.setSystitle(listPerform.getListperformid()); - - //部门id - user.setSysunitorentid(deptId); - //修改用户信息 - sysUserMapper.changePost(user); - - //删除原岗位 - listPerformMapper.deleteByPrimaryKey(dutyId); - - - } - } - return result; - } - - /** - * 处理密码 - * @return - * @throws Exception - */ - @ApiOperation(value = "处理密码", notes = "处理密码") - @RequestMapping(value = "changeUserPassword", method = RequestMethod.POST) - @ResponseBody - public SingleResult changeUserPassword()throws Exception{ - SingleResult result = new SingleResult<>(); - List sysUsers = sysUserMapper.findAll(); - for (SysUser sysUser : sysUsers){ - String oldPasswd = "csaq123456"; - String passwd = PasswdFactory.encryptPasswd(sysUser.getSysuserid(), sysUser.getSysusername(), oldPasswd); - if(passwd.equals(sysUser.getSyspassword())){ - String nowPasswd = PasswdFactory.encryptPasswd(sysUser.getSysuserid(), sysUser.getSysusername(), constantsConfigure.getDefaultPasswd()); - sysUserMapper.changePassword(sysUser.getSysuserid(),nowPasswd); - } - } - return result; - } - - - /** - * 街道导入企业新 - * @param multipartFile - * @return - * @throws Exception - */ - @ApiOperation(value = "街道导入企业新", notes = "街道导入企业新") - @RequestMapping(value = "/importEntNew", method = RequestMethod.POST) - @ResponseBody - private SingleResult importEntNew(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult result = new SingleResult<>(); - handleEntData(multipartFile); - return result; - } - - - public void handleEntData(MultipartFile multipartFile)throws Exception{ - if(null != multipartFile){ - 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(); - - List enterprises = new ArrayList<>(); - - Map inherentRiskMap = new HashMap<>(); - inherentRiskMap.put("红","4"); - inherentRiskMap.put("橙","3"); - inherentRiskMap.put("黄","2"); - inherentRiskMap.put("蓝","1"); - - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - - String entName = "";//名称 - String addresss = "";//地址 - String streetName = "";//街道 - String communityName = "";//社区 - String inherentRisk = "";//静态风险 - String inclassName = "";//行业名 - String name = "";//法人名 - String mobile = "";//法人联系方式 - String safeManager = "";//安全管理人员 - String safeTelephone = "";//安全管理人员联系方式 - - - //名称 - Cell cell = row.getCell((short)0); - if(null != cell){ - entName = dataFormatter.formatCellValue(cell); - } - - //社区 - cell = row.getCell((short)1); - if(null != cell){ - streetName = dataFormatter.formatCellValue(cell); - } - - //社区 - cell = row.getCell((short)2); - if(null != cell){ - communityName = dataFormatter.formatCellValue(cell); - } - - //地址 - cell = row.getCell((short)3); - if(null != cell){ - addresss = dataFormatter.formatCellValue(cell); - } - - //静态风险 - cell = row.getCell((short)4); - if(null != cell){ - inherentRisk = dataFormatter.formatCellValue(cell); - } - - //行业名 - cell = row.getCell((short)5); - if(null != cell){ - inclassName = dataFormatter.formatCellValue(cell); - } - - //法人名 - cell = row.getCell((short)6); - if(null != cell){ - name = dataFormatter.formatCellValue(cell); - } - - - //法人联系方式 - cell = row.getCell((short)7); - if(null != cell){ - mobile = dataFormatter.formatCellValue(cell); - } - - //安全管理人员 - cell = row.getCell((short)8); - if(null != cell){ - safeManager = dataFormatter.formatCellValue(cell); - } - - //安全管理人员联系方式 - cell = row.getCell((short)9); - if(null != cell){ - safeTelephone = dataFormatter.formatCellValue(cell); - } - - if(StringUtils.isNotBlank(entName)){ - - - System.out.println("entName -> "+entName); - System.out.println("addresss -> "+addresss); - System.out.println("streetName -> "+streetName); - System.out.println("communityName -> "+communityName); - System.out.println("inherentRisk -> "+inherentRisk); - System.out.println("inclassName -> "+inclassName); - System.out.println("name -> "+name); - System.out.println("mobile -> "+mobile); - System.out.println("safeManager -> "+safeManager); - System.out.println("safeTelephone -> "+safeTelephone); - - - - - - SysEnterprise enterprise = new SysEnterprise(); - enterprise.setSysenterpriseid(RandomNumber.getUUid()); - enterprise.setEntname(entName); - - - enterprise.setComplite("未评级"); - enterprise.setSysaddress(addresss); - - //静态风险 - if(StringUtils.isNotBlank(inherentRisk)){ - inherentRisk = inherentRiskMap.get(inherentRisk); - }else{ - inherentRisk = 1+""; - } - enterprise.setInherentRisk(inherentRisk); - System.out.println("inherentRisk -> "+inherentRisk); - - enterprise.setSafeManager(safeManager); - enterprise.setSafeTelephone(safeTelephone); - - enterprise.setSysUnitId(""); - enterprise.setLegalrepre(name); - enterprise.setLrlinktel(mobile); - enterprise.setSafeManager(name); - enterprise.setSafeTelephone(mobile); - enterprise.setLegalrepre(name); - enterprise.setRisklevel("低风险"); - enterprise.setCreatedon(new Date()); - enterprise.setModifiedon(new Date()); - enterprise.setCreatedby("导入"); - enterprise.setModifiedby("导入"); - - - - - //更新 - String districtId = "510114"; - enterprise.setOrgcode(districtId); - - //街道id - String streetCode = ""; - SysOrg street = sysOrgMapper.findByName(streetName,districtId); - if(null != street){ - streetCode = street.getOrgcode(); - - } - System.out.println("streetCode -> "+streetCode); - enterprise.setStreetCode(streetCode); - - //社区id - String communityCode = ""; - if(StringUtils.isNotBlank(streetCode)){ - SysOrg sysOrg = sysOrgMapper.findByName(communityName,streetCode); - if(null != sysOrg){ - communityCode = sysOrg.getOrgcode(); - } - } - System.out.println("communityCode -> "+communityCode); - enterprise.setCommunityCode(communityCode); - - - //行业 - BaseInClass baseInClass = baseInClassMapper.findByNameAndType(inclassName); - if(null != baseInClass){ - System.out.println(baseInClass.getIndustryclassname() + " - " + baseInClass.getBaseinclassid()); - enterprise.setWorkClassId(baseInClass.getBaseinclassid()); - } - - - SysEnterprise company = sysEnterpriseMapper.findByName(enterprise.getEntname()); - if (null != company) { - enterprise.setSysenterpriseid(company.getSysenterpriseid()); - sysEnterpriseMapper.changeImportEnt(enterprise); - }else{ - sysEnterpriseMapper.insert(enterprise); - } - - createEntUser(enterprise, "管理员",null); - - //生成最小工作单元 - saveEntWork(enterprise.getSysenterpriseid()); - - - System.out.println("--------------------------------------"); - - } - - - - - } - - - - - } - } - } - System.out.println("数据解析完成"); - } - - - /** - * 街道导入驻村干部 - * @param multipartFile - * @return - * @throws Exception - */ - @ApiOperation(value = "街道导入驻村干部", notes = "街道导入驻村干部") - @RequestMapping(value = "/importUserCadre", method = RequestMethod.POST) - @ResponseBody - public SingleResult importUserCadre(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult result = new SingleResult<>(); - handleUserCadre(multipartFile); - return result; - } - - /** - * 街道导入驻村干部 - * @param multipartFile - * @throws Exception - */ - public void handleUserCadre(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; - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - - int index = i+1; - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - String streetName = ""; - String postName = ""; - String userName = ""; - String chinaName = ""; - - - Cell cell = row.getCell((short)0); - if(null != cell){ - streetName = dataFormatter.formatCellValue(cell); - } - - - cell = row.getCell((short)2); - if(null != cell){ - postName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)3); - if(null != cell){ - userName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)4); - if(null != cell){ - chinaName = dataFormatter.formatCellValue(cell); - } - - streetName = StringUtils.replaceBlank(streetName); - postName = StringUtils.replaceBlank(postName); - userName = StringUtils.replaceBlank(userName); - chinaName = StringUtils.replaceBlank(chinaName); - - System.out.println(streetName+"-"+postName+"-"+userName+"-"+chinaName); - -// - //区部门id - String districtUnitId = "fe4a2834-c754-4ed1-97db-4914c822d820"; - //部门信息 - SysUnit streetUnit = sysUnitMapper.findByUnitName(streetName,districtUnitId); -// -// - ListPerform perform = handleCadrePost(streetName,postName,chinaName); - System.out.println("perform -> "+perform.getListperformid()); - - - - SysUser sysUser = sysUserMapper.findBySysUserName(userName); - if(null == sysUser){ - sysUser = new SysUser(); - sysUser.setSysuserid(RandomNumber.getUUid()); - sysUser.setUsertype("政府用户"); - - //区id - sysUser.setOrgcode(DISTRICT_ID); - - //街道id - String streetCode = ""; - SysOrg streetOrg = sysOrgMapper.findByName(streetName,DISTRICT_ID); - if(null != streetOrg){ - streetCode = streetOrg.getOrgcode(); - } - sysUser.setStreetCode(streetCode); - - sysUser.setSysunitorentid(streetUnit.getSysunitid()); - sysUser.setSysusername(userName); - sysUser.setChinaname(chinaName); - sysUser.setMobiletel(userName); - String passwd = PasswdFactory.encryptPasswd(sysUser.getSysuserid(), sysUser.getSysusername(), constantsConfigure.getDefaultPasswd()); - sysUser.setSyspassword(passwd); - sysUser.setUserroles("295EF8C3-902F-41F0-95C8-D3AB9C6DA145"); - sysUser.setSystitle(perform.getListperformid()); - sysUser.setState("启用"); - sysUser.setCreatedby("导入"); - sysUser.setModifiedby("导入"); - sysUser.setCreatedon(new Date()); - sysUser.setModifiedon(new Date()); - sysUserMapper.insert(sysUser); - }else{ - - //区id - sysUser.setOrgcode(DISTRICT_ID); - -//街道id - String streetCode = ""; - SysOrg streetOrg = sysOrgMapper.findByName(streetName,DISTRICT_ID); - if(null != streetOrg){ - streetCode = streetOrg.getOrgcode(); - } - sysUser.setStreetCode(streetCode); - - sysUser.setMobiletel(userName); - - sysUserMapper.changeMobile(sysUser); - - } - } - - } - } - } - } - - /** - * 驻村干部岗位 - * @param streetName - * @param postName - * @return - * @throws Exception - */ - private ListPerform handleCadrePost(String streetName,String postName,String chinaName)throws Exception{ - ListPerform perform = new ListPerform(); - //区岗位id - String districtPerformId = "669dcdbd-aabd-44f7-b035-003c042f9e06"; - - ListPerform streetPerform = listPerformMapper.findByName(streetName,districtPerformId); - if(null != streetPerform){ - - - - perform = new ListPerform(); - perform.setListperformid(RandomNumber.getUUid()); - perform.setPerformclassname(postName); - perform.setPerformName(chinaName); - perform.setSortid(350); - perform.setSupclassid(streetPerform.getListperformid()); - perform.setCreatedby("导入"); - perform.setModifiedby("导入"); - perform.setCreatedon(new Date()); - perform.setModifiedon(new Date()); - listPerformMapper.insert(perform); - } - return perform; - } - - /** - * 街道导入企业带一期行业 - * @param multipartFile - * @return - * @throws Exception - */ - @ApiOperation(value = "街道导入企业带一期行业", notes = "街道导入企业带一期行业") - @RequestMapping(value = "/importEntInclass", method = RequestMethod.POST) - @ResponseBody - private SingleResult importEntInclass(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult result = new SingleResult<>(); - handleEntInclassData(multipartFile); - return result; - } - - - public void handleEntInclassData(MultipartFile multipartFile)throws Exception{ - if(null != multipartFile){ - 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(); - - List enterprises = new ArrayList<>(); - - Map inherentRiskMap = new HashMap<>(); - inherentRiskMap.put("红","4"); - inherentRiskMap.put("橙","3"); - inherentRiskMap.put("黄","2"); - inherentRiskMap.put("蓝","1"); - - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - - String entName = "";//名称 - String addresss = "";//地址 - String streetName = "";//街道 - String communityName = "";//社区 - String inherentRisk = "";//静态风险 - String inName = "";//行业名 - String inclassName = "";//最小工作单元行业名 - String name = "";//法人名 - String mobile = "";//法人联系方式 - String safeManager = "";//安全管理人员 - String safeTelephone = "";//安全管理人员联系方式 - - - //名称 - Cell cell = row.getCell((short)0); - if(null != cell){ - entName = dataFormatter.formatCellValue(cell); - } - - //社区 - cell = row.getCell((short)1); - if(null != cell){ - streetName = dataFormatter.formatCellValue(cell); - } - - //社区 - cell = row.getCell((short)2); - if(null != cell){ - communityName = dataFormatter.formatCellValue(cell); - } - - //地址 - cell = row.getCell((short)3); - if(null != cell){ - addresss = dataFormatter.formatCellValue(cell); - } - - //静态风险 - cell = row.getCell((short)4); - if(null != cell){ - inherentRisk = dataFormatter.formatCellValue(cell); - } - - //行业名 - cell = row.getCell((short)5); - if(null != cell){ - inName = dataFormatter.formatCellValue(cell); - } - - //最小工作单元行业名 - cell = row.getCell((short)6); - if(null != cell){ - inclassName = dataFormatter.formatCellValue(cell); - } - - //法人名 - cell = row.getCell((short)7); - if(null != cell){ - name = dataFormatter.formatCellValue(cell); - } - - - //法人联系方式 - cell = row.getCell((short)8); - if(null != cell){ - mobile = dataFormatter.formatCellValue(cell); - } - - //安全管理人员 - cell = row.getCell((short)9); - if(null != cell){ - safeManager = dataFormatter.formatCellValue(cell); - } - - //安全管理人员联系方式 - cell = row.getCell((short)10); - if(null != cell){ - safeTelephone = dataFormatter.formatCellValue(cell); - } - - if(StringUtils.isNotBlank(entName)){ - - - System.out.println("entName -> "+entName); - System.out.println("addresss -> "+addresss); - System.out.println("streetName -> "+streetName); - System.out.println("communityName -> "+communityName); - System.out.println("inherentRisk -> "+inherentRisk); - System.out.println("inclassName -> "+inclassName); - System.out.println("name -> "+name); - System.out.println("mobile -> "+mobile); - System.out.println("safeManager -> "+safeManager); - System.out.println("safeTelephone -> "+safeTelephone); - - - - - - SysEnterprise enterprise = new SysEnterprise(); - enterprise.setSysenterpriseid(RandomNumber.getUUid()); - enterprise.setEntname(entName); - - - enterprise.setComplite("未评级"); - enterprise.setSysaddress(addresss); - - //静态风险 - if(StringUtils.isNotBlank(inherentRisk)){ - inherentRisk = inherentRiskMap.get(inherentRisk); - }else{ - inherentRisk = 1+""; - } - enterprise.setInherentRisk(inherentRisk); - System.out.println("inherentRisk -> "+inherentRisk); - - enterprise.setSafeManager(safeManager); - enterprise.setSafeTelephone(safeTelephone); - - enterprise.setSysUnitId(""); - enterprise.setLegalrepre(name); - enterprise.setLrlinktel(mobile); - enterprise.setSafeManager(name); - enterprise.setSafeTelephone(mobile); - enterprise.setLegalrepre(name); - enterprise.setRisklevel("低风险"); - enterprise.setCreatedon(new Date()); - enterprise.setModifiedon(new Date()); - enterprise.setCreatedby("导入"); - enterprise.setModifiedby("导入"); - - - - - //更新 - String districtId = "510114"; - enterprise.setOrgcode(districtId); - - //街道id - String streetCode = ""; - SysOrg street = sysOrgMapper.findByName(streetName,districtId); - if(null != street){ - streetCode = street.getOrgcode(); - - } - System.out.println("streetCode -> "+streetCode); - enterprise.setStreetCode(streetCode); - - //社区id - String communityCode = ""; - if(StringUtils.isNotBlank(streetCode)){ - SysOrg sysOrg = sysOrgMapper.findByName(communityName,streetCode); - if(null != sysOrg){ - communityCode = sysOrg.getOrgcode(); - } - } - System.out.println("communityCode -> "+communityCode); - enterprise.setCommunityCode(communityCode); - - - //最小工作行业 - BaseInClass baseInClass = baseInClassMapper.findByNameAndType(inclassName); - if(null != baseInClass){ - System.out.println(baseInClass.getIndustryclassname() + " - " + baseInClass.getBaseinclassid()); - enterprise.setWorkClassId(baseInClass.getBaseinclassid()); - } - - //行业 - BaseInClass inClass = baseInClassMapper.selectByName(inName); - if(null != inClass){ - System.out.println(inClass.getIndustryclassname() + " - " + inClass.getBaseinclassid()); - enterprise.setBaseinclassid(inClass.getBaseinclassid()); - } - - - SysEnterprise company = sysEnterpriseMapper.findByName(enterprise.getEntname()); - if (null != company) { - enterprise.setSysenterpriseid(company.getSysenterpriseid()); - sysEnterpriseMapper.changeImportEnt(enterprise); - }else{ - sysEnterpriseMapper.insert(enterprise); - } - - handleEetUser(enterprise.getSysenterpriseid()); - - //生成最小工作单元 - saveEntWork(enterprise.getSysenterpriseid()); - - - System.out.println("--------------------------------------"); - - } - - - - - } - - - - - } - } - } - System.out.println("数据解析完成"); - } - - @ApiOperation(value = "导入物流仓库", notes = "导入物流仓库") - @RequestMapping(value = "/inportStorage", method = RequestMethod.POST) - @ResponseBody - public SingleResult inportStorage(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult result = new SingleResult<>(); - handleStorageData(multipartFile); - return result; - } - - - public void handleStorageData(MultipartFile multipartFile)throws Exception{ - if(null != multipartFile){ - 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 inherentRiskMap = new HashMap<>(); - inherentRiskMap.put("红","4"); - inherentRiskMap.put("红色","4"); - inherentRiskMap.put("橙","3"); - inherentRiskMap.put("橙色","3"); - inherentRiskMap.put("黄","2"); - inherentRiskMap.put("黄色","2"); - inherentRiskMap.put("蓝","1"); - inherentRiskMap.put("蓝色","1"); - - - Integer index = 1; - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - - //场所名称 - String name = ""; - Cell cell = row.getCell((short)0); - if(null != cell){ - name = dataFormatter.formatCellValue(cell); - } - - /** - * 街道id - */ - String streetCode = ""; - - //街道名 - String streetName = ""; - cell = row.getCell((short)1); - if(null != cell){ - streetName = dataFormatter.formatCellValue(cell); - } - - /** - * 社区id - */ - String communityCode = ""; - - /** - * 地址 - */ - String address = ""; - cell = row.getCell((short)2); - if(null != cell){ - address = dataFormatter.formatCellValue(cell); - } - - /** - * 所在建筑是否通过建设工程消防设计审核和验收 - */ - String checkState = ""; - cell = row.getCell((short)3); - if(null != cell){ - checkState = dataFormatter.formatCellValue(cell); - } - - /** - * 储存物资类型高于仓库类型和耐火等级 - */ - String refractoryLevel = ""; - cell = row.getCell((short)4); - if(null != cell){ - refractoryLevel = dataFormatter.formatCellValue(cell); - } - - /** - * 仓储面积(平方米) - */ - String areaNum = ""; - cell = row.getCell((short)5); - if(null != cell){ - areaNum = dataFormatter.formatCellValue(cell); - } - - /** - * 是否改变建筑使用性质 - */ - String natureState = ""; - cell = row.getCell((short)6); - if(null != cell){ - natureState = dataFormatter.formatCellValue(cell); - } - - /** - * 消防设施、设备情况 - */ - String fireControl = ""; - cell = row.getCell((short)7); - if(null != cell){ - fireControl = dataFormatter.formatCellValue(cell); - } - - /** - * 存在其他消防隐患 - */ - String otherDanger = ""; - cell = row.getCell((short)8); - if(null != cell){ - otherDanger = dataFormatter.formatCellValue(cell); - } - - /** - * 所在建筑是否具有国土、规划手续 - */ - String procedures = ""; - cell = row.getCell((short)9); - if(null != cell){ - procedures = dataFormatter.formatCellValue(cell); - } - - /** - * 是否办理营业执照 - */ - String licenseState = ""; - cell = row.getCell((short)10); - if(null != cell){ - licenseState = dataFormatter.formatCellValue(cell); - } - - /** - * 经度 - */ - String lon = ""; - - - /** - * 纬度 - */ - String lat = ""; - - String lonlat = ""; - - cell = row.getCell((short)11); - if(null != cell){ - lonlat = dataFormatter.formatCellValue(cell); - } - - /** - * 储存物资类型 - */ - String materialType = ""; - cell = row.getCell((short)12); - if(null != cell){ - materialType = dataFormatter.formatCellValue(cell); - } - - /** - * 风险等级 红:4 橙:3 黄:2 蓝:1 - */ - String riskLevel = ""; - cell = row.getCell((short)13); - if(null != cell){ - riskLevel = dataFormatter.formatCellValue(cell); - } - - /** - * 联系人 - */ - String contacts = ""; - cell = row.getCell((short)14); - if(null != cell){ - contacts = dataFormatter.formatCellValue(cell); - } - - /** - * 联系电话 - */ - String mobile = ""; - cell = row.getCell((short)15); - if(null != cell){ - mobile = dataFormatter.formatCellValue(cell); - } - - /** - * 备注 - */ - String remarks = ""; - cell = row.getCell((short)16); - if(null != cell){ - remarks = dataFormatter.formatCellValue(cell); - } - -// System.out.println(name+"-"+streetName+"-"+lonlat); - if(lonlat.contains(",30")){ -// System.out.println(lonlat); - String[] lonlats = lonlat.split(","); - lon = lonlats[0]; - lat = lonlats[1]; - index++; - } - - String riskLevelStr = ""; - if(StringUtils.isNotBlank(riskLevel)){ - riskLevelStr = inherentRiskMap.get(riskLevel); - } - - - - - String orgCode = "510114"; - Storage storage = new Storage(); - storage.setStorageId(RandomNumber.getUUid()); - storage.setName(name); - - storage.setOrgcode(orgCode); - - if(StringUtils.isNotBlank(streetName)){ - SysOrg street = sysOrgMapper.findByName(streetName,"orgCode"); - if(null != street){ - storage.setStreetCode(street.getOrgcode()); - } - } - - storage.setAddress(address); - storage.setCheckState(checkState); - storage.setRefractoryLevel(refractoryLevel); - storage.setAreaNum(areaNum); - storage.setNatureState(natureState); - storage.setFireControl(fireControl); - storage.setOtherDanger(otherDanger); - storage.setProcedures(procedures); - storage.setLicenseState(licenseState); - storage.setLon(lon); - storage.setLat(lat); - storage.setMaterialType(materialType); - storage.setRiskLevel(riskLevelStr); - storage.setContacts(contacts); - storage.setMobile(mobile); - storage.setRemarks(remarks); - storage.setCreateBy("导入"); - storage.setCreateTime(new Date()); - storage.setModifyBy("导入"); - storage.setModifyTime(new Date()); - - storageMapper.insert(storage); - System.out.println(lon+"--"+lat); - - - } - System.out.println(index); - } - } - } - System.out.println("数据解析完成"); - } - - /** - * 导入指标库 - * @version v1.0 - * @author dong - * @date 2022/7/18 14:59 - */ - @ApiOperation(value = "导入指标库", notes = "导入指标库") - @RequestMapping(value = "/inportCheckItem", method = RequestMethod.POST) - @ResponseBody - public SingleResult inportCheckItem(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult 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 industryMap = new HashMap<>(); - industryMap.put("烟花爆竹","4cfbc295-4b8f-4ddd-be15-92f5007edc3d"); - industryMap.put("危险化学品","925e43c7-6112-475e-b139-8a15fa2c6f7f"); - - - ChkBillDetailWithBLOBs chkBillDetail = new ChkBillDetailWithBLOBs(); - String workUnit = ""; - String checkmethod = ""; - String demand = ""; - - - - - Integer index = 1; - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - - Cell cell = row.getCell((short)1); - if(null != cell){ - chkBillDetail.setBaseinclassid(dataFormatter.formatCellValue(cell)); - } - - - cell = row.getCell((short)2); - if(null != cell){ - workUnit = dataFormatter.formatCellValue(cell); - } - - - cell = row.getCell((short)3); - if(null != cell){ - chkBillDetail.setCheckobjectname(dataFormatter.formatCellValue(cell)); - } - - cell = row.getCell((short)4); - if(null != cell){ - checkmethod = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)5); - if(null != cell){ - demand = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)6); - if(null != cell){ - chkBillDetail.setCheckbasis(dataFormatter.formatCellValue(cell)); - } - - - checkmethod = "检查方法:\n"+checkmethod+"\n"+"检查要求:\n"+demand; - chkBillDetail.setCheckmethod(checkmethod); - chkBillDetail.setBaseinclassid(industryMap.get(chkBillDetail.getBaseinclassid())); - chkBillDetail.setChkbilldetailid(RandomNumber.getUUid()); - chkBillDetail.setCreatedby("excel"); - chkBillDetail.setCreatedon(new Date()); - chkBillDetail.setModifiedby("excel"); - chkBillDetail.setModifiedon(new Date()); - chkBillDetailMapper.insert(chkBillDetail); - } - System.out.println(index); - } - } - return result; - } - - - /** - * 最小工作单元处理 - * @version v1.0 - * @author dong - * @date 2022/7/18 14:59 - */ - @ApiOperation(value = "最小工作单元处理", notes = "最小工作单元处理") - @RequestMapping(value = "/handleMinUnit", method = RequestMethod.POST) - @ResponseBody - public SingleResult handleMinUnit(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult 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(); - - - - - ChkBillDetailWithBLOBs chkBillDetail = new ChkBillDetailWithBLOBs(); - String workUnit = ""; - - - - List itemIds = new ArrayList<>(); - - Integer index = 1; - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - String name = ""; - - Cell cell = row.getCell((short)1); - if(null != cell){ - chkBillDetail.setBaseinclassid(dataFormatter.formatCellValue(cell)); - } - - - cell = row.getCell((short)2); - if(null != cell){ - workUnit = dataFormatter.formatCellValue(cell); - } - - - cell = row.getCell((short)3); - if(null != cell){ - name = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)6); - if(null != cell){ - chkBillDetail.setCheckbasis(dataFormatter.formatCellValue(cell)); - } - - chkBillDetail = chkBillDetailMapper.findByName(name); - if(null != chkBillDetail){ - itemIds.add(chkBillDetail.getChkbilldetailid()); - } - - } - - String str = ""; - if(null != itemIds && itemIds.size() > 0){ - for (String itemId : itemIds){ - if(StringUtils.isNotBlank(str)){ - str += ","+itemId; - }else{ - str = itemId; - } - } - } - - MinWorkUnitCategory category = new MinWorkUnitCategory(); - category.setId(RandomNumber.getUUid()); - category.setTitle(workUnit); - category.setChkbilldetailids(str); - category.setCreateTime(new Date()); - - minWorkUnitCategoryMapper.insert(category); - - //分类检查项 - String chkbilldetailids = category.getChkbilldetailids(); - if(StringUtils.isNotBlank(chkbilldetailids)){ - - minMiddleIndexMapper.deleteMinMiddleIndex(category.getId()); - - String[] strs = chkbilldetailids.split(","); - List minMiddleIndices = new ArrayList<>(); - for (String sts : strs){ - MinMiddleIndex minMiddleIndex = new MinMiddleIndex(); - minMiddleIndex.setId(RandomNumber.getUUid()); - minMiddleIndex.setMinCategoryId(category.getId()); - minMiddleIndex.setIndexId(sts); - minMiddleIndex.setCreateTime(new Date()); - minMiddleIndices.add(minMiddleIndex); - } - minMiddleIndexMapper.insertList(minMiddleIndices); - } - - System.out.println(index); - } - } - return result; - } - /** * 导入岗位履职和履职清单 * @version v1.0 @@ -3029,14 +89,9 @@ public class ImportController extends com.rzyc.controller.BaseController { Boolean isSubject = true; DataFormatter dataFormatter = new DataFormatter(); - - - ChkBillDetailWithBLOBs chkBillDetail = new ChkBillDetailWithBLOBs(); String workUnit = ""; - - List itemIds = new ArrayList<>(); Map map = new HashMap<>(); @@ -3092,13 +147,7 @@ public class ImportController extends com.rzyc.controller.BaseController { } } - - } - - - - System.out.println(index); } } @@ -3106,146 +155,7 @@ public class ImportController extends com.rzyc.controller.BaseController { } - /** - * 街道导入驻村干部 - * @param multipartFile - * @return - * @throws Exception - */ - @ApiOperation(value = "街道导入驻村干部", notes = "街道导入驻村干部") - @RequestMapping(value = "/importAdminUser", method = RequestMethod.POST) - @ResponseBody - public SingleResult importAdminUser(@RequestBody MultipartFile multipartFile)throws Exception{ - SingleResult result = new SingleResult<>(); - 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; - - //获得所有数据 - for(int i = 1 ; i <= totalRowNum ; i++){ - - int index = i+1; - //获得第i行对象 - Row row = sheet.getRow(i); - if(null == row){ - break; - } - - String streetName = ""; - String postName = ""; - String userName = ""; - String chinaName = ""; - - - Cell cell = row.getCell((short)0); - if(null != cell){ - streetName = dataFormatter.formatCellValue(cell); - } - - - cell = row.getCell((short)2); - if(null != cell){ - postName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)3); - if(null != cell){ - userName = dataFormatter.formatCellValue(cell); - } - - cell = row.getCell((short)4); - if(null != cell){ - chinaName = dataFormatter.formatCellValue(cell); - } - - streetName = StringUtils.replaceBlank(streetName); - postName = StringUtils.replaceBlank(postName); - userName = StringUtils.replaceBlank(userName); - chinaName = StringUtils.replaceBlank(chinaName); - - System.out.println(streetName+"-"+postName+"-"+userName+"-"+chinaName); - -// - //区部门id - String districtUnitId = "fe4a2834-c754-4ed1-97db-4914c822d820"; - //部门信息 - SysUnit streetUnit = sysUnitMapper.findByUnitName(streetName,districtUnitId); -// -// - ListPerform perform = handleCadrePost(streetName,postName,chinaName); - System.out.println("perform -> "+perform.getListperformid()); - - - - SysUser sysUser = sysUserMapper.findBySysUserName(userName); - if(null == sysUser){ - sysUser = new SysUser(); - sysUser.setSysuserid(RandomNumber.getUUid()); - sysUser.setUsertype("政府用户"); - - //区id - sysUser.setOrgcode(DISTRICT_ID); - - //街道id - String streetCode = ""; - SysOrg streetOrg = sysOrgMapper.findByName(streetName,DISTRICT_ID); - if(null != streetOrg){ - streetCode = streetOrg.getOrgcode(); - } - sysUser.setStreetCode(streetCode); - - sysUser.setSysunitorentid(streetUnit.getSysunitid()); - sysUser.setSysusername(userName); - sysUser.setChinaname(chinaName); - sysUser.setMobiletel(userName); - String passwd = PasswdFactory.encryptPasswd(sysUser.getSysuserid(), sysUser.getSysusername(), constantsConfigure.getDefaultPasswd()); - sysUser.setSyspassword(passwd); - sysUser.setUserroles("295EF8C3-902F-41F0-95C8-D3AB9C6DA145"); - sysUser.setSystitle(perform.getListperformid()); - sysUser.setState("启用"); - sysUser.setCreatedby("导入"); - sysUser.setModifiedby("导入"); - sysUser.setCreatedon(new Date()); - sysUser.setModifiedon(new Date()); - sysUserMapper.insert(sysUser); - }else{ - - //区id - sysUser.setOrgcode(DISTRICT_ID); - -//街道id - String streetCode = ""; - SysOrg streetOrg = sysOrgMapper.findByName(streetName,DISTRICT_ID); - if(null != streetOrg){ - streetCode = streetOrg.getOrgcode(); - } - sysUser.setStreetCode(streetCode); - - sysUser.setMobiletel(userName); - - sysUserMapper.changeMobile(sysUser); - - } - } - - } - } - } - return result; - } diff --git a/inventory-gov/src/main/java/com/rzyc/controller/ManualController.java b/inventory-gov/src/main/java/com/rzyc/controller/ManualController.java deleted file mode 100644 index ee80f36..0000000 --- a/inventory-gov/src/main/java/com/rzyc/controller/ManualController.java +++ /dev/null @@ -1,419 +0,0 @@ -package com.rzyc.controller; - -import com.alibaba.fastjson.JSON; -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.MultiResult; -import com.common.utils.model.Pager; -import com.common.utils.model.SingleResult; -import com.github.pagehelper.Page; -import com.github.pagehelper.PageHelper; -import com.rzyc.bean.emergency.*; -import com.rzyc.bean.emergency.dto.*; -import com.rzyc.enums.ManualLableType; -import com.rzyc.model.oth.*; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.beanutils.BeanUtils; -import org.springframework.stereotype.Controller; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.*; - -/** - * 电子工作手册 - */ -@Api(tags = "电子工作手册") -@CrossOrigin("*") -@RequestMapping("manual") -@Controller -@Validated -public class ManualController extends BaseController{ - - - @ApiOperation(value = "预案树形", notes = "预案树形") - @GetMapping("/planTree") - @ResponseBody - public MultiResult planTree()throws Exception{ - MultiResult result = new MultiResult<>(); - List planLists = new ArrayList<>(); - - //预案分类 - List othTypes = othTypeMapper.selectList(); - if(null != othTypes && othTypes.size() > 0){ - for (OthType othType :othTypes){ - PlanList planList = new PlanList(); - planList.setOthplanid(othType.getOthtypeid()); - planList.setPlanname(othType.getOthtypename()); - planLists.add(planList); - } - } - - //预案列表 - List plans = othPlanMapper.planList(); - if(null != plans && plans.size() > 0){ - planLists.addAll(plans); - } - - if(planLists.size() > 0){ - //处理树形结构 - JSONArray jsonArray = handleAreaTree(planLists); - List parseArray = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),PlanList.class); - result.setData(parseArray); - } - return result; - } - - /** - * 预案树形结构 - * @param planLists - * @return - * @throws Exception - */ - private JSONArray handleAreaTree(List planLists)throws Exception{ - List> data = new ArrayList<>(); - for(PlanList planList : planLists){ - if(StringUtils.isBlank(planList.getParentId())){ - planList.setParentId(""); - } - Map entUserMap = new HashMap(); - entUserMap.put("othplanid",planList.getOthplanid()); - entUserMap.put("planname",planList.getPlanname()); - entUserMap.put("parentId",planList.getParentId()); - - data.add(entUserMap); - } - JSONArray result = TypeConversion.listToTree(JSONArray.parseArray(JSON.toJSONString(data)),"othplanid","parentId","children"); - return result; - } - - /** - * 工作手册修改或新增 - * @param manualChangeDto - * @return - * @throws Exception - */ - @ApiOperation(value = "工作手册修改或新增", notes = "工作手册修改或新增") - @PostMapping("/manualChange") - @ResponseBody - public SingleResult manualChange(@Valid @RequestBody ManualChangeDto manualChangeDto)throws Exception{ - SingleResult result = new SingleResult<>(); - Manual manual = new Manual(); - String userId = getUserId(); - BeanUtils.copyProperties(manual,manualChangeDto); - manual.setModifyTime(new Date()); - manual.setModified(userId); - Manual oldmanual = manualMapper.selectById(manualChangeDto.getManualId()); - if(null != oldmanual){ - manualMapper.updateById(manual); - }else{ - manual.setCreated(userId); - manual.setCreateTime(new Date()); - manualMapper.insert(manual); - } - return result; - } - - /** - * 工作手册分页 - * @return - * @throws Exception - */ - @ApiOperation(value = "工作手册分页", notes = "工作手册分页") - @GetMapping("/manualPage") - @ResponseBody - public SingleResult> manualPage(@Valid ManualPageDto manualPageDto)throws Exception{ - SingleResult> result = new SingleResult<>(); - Pager pager = new Pager<>(); - String condition = TypeConversion.getCondition(manualPageDto.getCondition()); - PageHelper.startPage(manualPageDto.getPage(), manualPageDto.getPageSize()); - Page page = (Page) manualMapper.manualList(condition); - getDatePage(pager,page); - result.setData(pager); - return result; - } - - /** - * 工作手册标签新增 - * @param manualLableAddDto - * @return - * @throws Exception - */ - @ApiOperation(value = "工作手册标签新增", notes = "工作手册标签新增") - @PostMapping("/manualLableAdd") - @ResponseBody - public SingleResult manualLableAdd(@Valid ManualLableAddDto manualLableAddDto)throws Exception{ - SingleResult result = new SingleResult<>(); - String userId = getUserId(); - ManualLable manualLable = new ManualLable(); - BeanUtils.copyProperties(manualLable,manualLableAddDto); - manualLable.setLableId(RandomNumber.getUUid()); - manualLable.setCreated(userId); - manualLable.setCreateTime(new Date()); - manualLableMapper.insert(manualLable); - return result; - } - - /** - * 工作手册标签删除 - * @param lableId - * @return - * @throws Exception - */ - @ApiOperation(value = "工作手册标签删除", notes = "工作手册标签删除") - @PostMapping("/manualLableDel/{lableId}") - @ApiImplicitParam(name = "lableId",value = "标签id",required = true) - @ResponseBody - public SingleResult manualLableDel(@PathVariable String lableId)throws Exception{ - SingleResult result = new SingleResult<>(); - manualLableMapper.deleteById(lableId); - return result; - } - - /** - * 工作手册标签列表 - * @param manualLableListDto - * @return - * @throws Exception - */ - @ApiOperation(value = "工作手册标签列表", notes = "工作手册标签列表") - @GetMapping("/manualLableList") - @ResponseBody - public MultiResult manualLableList(@Valid ManualLableListDto manualLableListDto)throws Exception{ - MultiResult result = new MultiResult<>(); - List manualLables = manualLableMapper.findByLableType(manualLableListDto.getManualId(),manualLableListDto.getLableType()); - result.setData(manualLables); - return result; - } - - /** - * 工作手册内容新增 - * @param contentAddDto - * @return - * @throws Exception - */ - @ApiOperation(value = "工作手册内容新增", notes = "工作手册标签列表") - @PostMapping("/manualContentAdd") - @ResponseBody - @Transactional - public SingleResult manualContentAdd(@Valid @RequestBody ContentAddDto contentAddDto)throws Exception{ - SingleResult result = new SingleResult<>(); - - - String userId = getUserId(); - - //工作手册等级列表 - List manualLevels = new ArrayList<>(); - - //工作手册时间列表 - List manualTimes = new ArrayList<>(); - - //工作手册措施 - List manualMeasures = new ArrayList<>(); - - //工作手册措施标签 - List lables = new ArrayList<>(); - - //当前时间 - Date nowDate = new Date(); - - //新增工作手册内容 - String manualId = contentAddDto.getManualId(); - //响应级别 - List levelDtos = contentAddDto.getLevelDtos(); - for (ManualLevelDto manualLevelDto : levelDtos){ - - //响应级别 - ManualLevel manualLevel = new ManualLevel(); - manualLevel.setLevelId(RandomNumber.getUUid()); - manualLevel.setManualId(manualId); - manualLevel.setLevelNum(manualLevelDto.getLevelNum()); - manualLevel.setManualDesc(manualLevelDto.getManualDesc()); - manualLevel.setCreated(userId); - manualLevel.setCreateTime(nowDate); - manualLevels.add(manualLevel); - - //响应时间处理 - List timeDtos = manualLevelDto.getChildren(); - if(null != timeDtos){ - for (ManualTimeDto manualTimeDto : timeDtos){ - ManualTime manualTime = new ManualTime(); - manualTime.setTimeId(RandomNumber.getUUid()); - manualTime.setManualId(manualId); - manualTime.setLevelId(manualLevel.getLevelId()); - manualTime.setTimeDesc(manualTimeDto.getTimeDesc()); - manualTime.setSortId(manualTimeDto.getSortId()); - manualTime.setCreateTime(nowDate); - manualTime.setCreated(userId); - manualTimes.add(manualTime); - - //处置措施 - List measuresDtos = manualTimeDto.getChildren(); - if(null != measuresDtos && measuresDtos.size() > 0){ - for (ManualMeasuresDto measuresDto : measuresDtos){ - ManualMeasures measures = new ManualMeasures(); - measures.setMeasuresId(RandomNumber.getUUid()); - measures.setManualId(manualId); - measures.setLevelId(manualLevel.getLevelId()); - measures.setTimeId(manualTime.getTimeId()); - measures.setMeasuresDesc(measuresDto.getMeasuresDesc()); - measures.setSortId(measuresDto.getSortId()); - measures.setDutyId(measuresDto.getDutyIds()); - measures.setLeadId(measuresDto.getLeadIds()); - measures.setWorkId(measuresDto.getWorkIds()); - measures.setDepartmentId(measuresDto.getDepartmentId()); - measures.setCreated(userId); - measures.setCreateTime(nowDate); - manualMeasures.add(measures); - - //责任组 - lables.addAll(handleIds(measuresDto.getDutyIds(), ManualLableType.DUTY.getType(), - manualId,measures.getMeasuresId(),userId,nowDate)); - - //牵头部门 - lables.addAll(handleIds(measuresDto.getLeadIds(), ManualLableType.LEAD.getType(), - manualId,measures.getMeasuresId(),userId,nowDate)); - - //牵头部门 - lables.addAll(handleIds(measuresDto.getWorkIds(), ManualLableType.WORK.getType(), - manualId,measures.getMeasuresId(),userId,nowDate)); - - //牵头部门 - lables.addAll(handleIds(measuresDto.getDepartmentId(), ManualLableType.DEPARTMENT.getType(), - manualId,measures.getMeasuresId(),userId,nowDate)); - - } - } - } - } - } - - //先删除之前的数据 - //响应级别 - manualLevelMapper.delByManualId(manualId); - //时间 - manualTimeMapper.delByManualId(manualId); - //处置措施 - manualMeasuresMapper.delByManualId(manualId); - //处置措施标签 - maMeasuresLableMapper.delByManualId(manualId); - - //插入 - manualLevelMapper.insertList(manualLevels); - //插入 - manualTimeMapper.insertList(manualTimes); - //插入 - manualMeasuresMapper.insertList(manualMeasures); - //插入 - maMeasuresLableMapper.insertList(lables); - - return result; - } - - /** - * - * @param ids - * @param type - * @param manualId - * @param measuresId - * @param userId - * @param nowDate - * @return - * @throws Exception - */ - private List handleIds(String ids,Integer type, - String manualId,String measuresId, - String userId,Date nowDate)throws Exception{ - - List lables = new ArrayList<>(); - if(StringUtils.isNotBlank(ids)){ - String[] strs = ids.split(","); - for (String str : strs){ - MaMeasuresLable maMeasuresLable = new MaMeasuresLable(); - maMeasuresLable.setRelationId(RandomNumber.getUUid()); - maMeasuresLable.setManualId(manualId); - maMeasuresLable.setMeasuresId(measuresId); - maMeasuresLable.setLableId(str); - maMeasuresLable.setLableType(type); - maMeasuresLable.setCreateTime(nowDate); - maMeasuresLable.setCreated(userId); - lables.add(maMeasuresLable); - } - } - return lables; - } - - @ApiOperation(value = "工作手册内容树形", notes = "工作手册内容树形") - @GetMapping("/manualContent") - @ResponseBody - public MultiResult manualContent(@Valid ManualContentDto manualContentDto)throws Exception{ - MultiResult result = new MultiResult<>(); - - manualContentDto.setDepartmentId(TypeConversion.getCondition(manualContentDto.getDepartmentId())); - manualContentDto.setDutyId(TypeConversion.getCondition(manualContentDto.getDutyId())); - manualContentDto.setWorkId(TypeConversion.getCondition(manualContentDto.getWorkId())); - manualContentDto.setLeadId(TypeConversion.getCondition(manualContentDto.getLeadId())); - - List manualLevels = manualLevelMapper.manualDetail(manualContentDto.getManualId(),manualContentDto); - result.setData(manualLevels); - return result; - } - - @ApiOperation(value = "工作手册内容分页", notes = "工作手册内容分页") - @GetMapping("/manualContentPage") - @ResponseBody - public SingleResult> manualContentPage(@Valid ManualContentListDto manualContentListDto)throws Exception{ - SingleResult> result = new SingleResult<>(); - manualContentListDto.setDepartmentId(TypeConversion.getCondition(manualContentListDto.getDepartmentId())); - manualContentListDto.setDutyId(TypeConversion.getCondition(manualContentListDto.getDutyId())); - manualContentListDto.setWorkId(TypeConversion.getCondition(manualContentListDto.getWorkId())); - manualContentListDto.setLeadId(TypeConversion.getCondition(manualContentListDto.getLeadId())); - Pager pager = new Pager<>(); - PageHelper.startPage(manualContentListDto.getPage(), manualContentListDto.getPageSize()); - Page page = (Page) manualLevelMapper.manualLevelList(manualContentListDto.getManualId(),manualContentListDto); - getDatePage(pager,page); - result.setData(pager); - return result; - } - - /** - * 工作响应级别列表 - * @param manualId - * @return - * @throws Exception - */ - @ApiOperation(value = "工作响应级别列表", notes = "工作响应级别列表") - @GetMapping("/manualLevelList/{manualId}") - @ApiImplicitParam(name = "manualId",value = "手册id",required = true) - @ResponseBody - public MultiResult manualLevelList(@PathVariable String manualId)throws Exception{ - MultiResult result = new MultiResult<>(); - List manualLevels = manualLevelMapper.findByManualId(manualId); - result.setData(manualLevels); - return result; - } - - /** - * 工作手册响应级别处置时间列表 - * @param levelId - * @return - * @throws Exception - */ - @ApiOperation(value = "工作手册响应级别处置时间列表", notes = "工作手册响应级别处置时间列表") - @GetMapping("/manualTimeList/{levelId}") - @ApiImplicitParam(name = "levelId",value = "响应级别id",required = true) - @ResponseBody - public MultiResult manualTimeList(@PathVariable String levelId)throws Exception{ - MultiResult result = new MultiResult<>(); - List manualLevels = manualTimeMapper.findByLevelId(levelId); - result.setData(manualLevels); - return result; - } - -} diff --git a/inventory-gov/src/main/java/com/rzyc/controller/OtherController.java b/inventory-gov/src/main/java/com/rzyc/controller/OtherController.java index 22c7d27..6f6ddf1 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/OtherController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/OtherController.java @@ -45,19 +45,6 @@ public class OtherController extends BaseController{ @Autowired private TaskService taskService; - /*动态详情*/ - @GetMapping(value = "/dynamicDetail") - public String newsDetail(String dynamicId,Model model){ - System.out.println("dynamicId --- > "+dynamicId); - Dynamic dynamic = newsCntMapper.newCntDetail(dynamicId); - if(null != dynamic){ - dynamic.setTime(DateUtils.parseDate2String(dynamic.getPublictime(), "yyyy-MM-dd")); - }else{ - dynamic = new Dynamic(); - } - model.addAttribute("dynamic",dynamic); - return "dynamic/dynamic_detail"; - } /** * 获取安全类型 @@ -144,164 +131,6 @@ public class OtherController extends BaseController{ return singleResult; } - /** - * 检查帮助 - * @param model - * @return - */ - @GetMapping("/govHelp") - public String govHelp(Model model){ - String type = "GOV"; - AppHelp appHelp = appHelpMapper.findByType(type); - if(null == appHelp){ - appHelp = new AppHelp(); - } - model.addAttribute("appHelp",appHelp); - return "help/gov_help"; - } - - /** - * 检查帮助 - * @param model - * @return - */ - @GetMapping("/entHelp") - public String entHelp(Model model){ - String type = "ENT"; - AppHelp appHelp = appHelpMapper.findByType(type); - if(null == appHelp){ - appHelp = new AppHelp(); - } - model.addAttribute("appHelp",appHelp); - return "help/ent_help"; - } - - /** - * 检查帮助 - * @param model - * @return - */ - @GetMapping("/appGovHelp") - public String appGovHelp(Model model){ - String type = "GOV"; - AppHelp appHelp = appHelpMapper.findByType(type); - if(null == appHelp){ - appHelp = new AppHelp(); - } - model.addAttribute("appHelp",appHelp); - return "help/app_gov_help"; - } - - /** - * 企业端检查帮助 - * @param model - * @return - */ - @GetMapping("/appEntHelp") - public String appEntHelp(Model model){ - String type = "ENT"; - AppHelp appHelp = appHelpMapper.findByType(type); - if(null == appHelp){ - appHelp = new AppHelp(); - } - model.addAttribute("appHelp",appHelp); - return "help/app_ent_help"; - } - - - /** - * 修改 - * @param appHelp - */ - @RequestMapping(value = "/changeGovHelp", method = RequestMethod.POST) - @ResponseBody - public String changeGovHelp(AppHelp appHelp){ - appHelpMapper.changeAppHelp(appHelp); - return "success"; - } - - - /*导入企业清单*/ - @GetMapping("/importList") - public String importList(){ - return "import_list/import_list"; - } - - /** - * 上传企业清单 - * @param file - * @return - */ - @RequestMapping(value = "/uploadEntList", method = RequestMethod.POST) - @ResponseBody - public Map uploadEntList(@RequestBody MultipartFile file,String entName) { - Map resultMap = new HashMap(); - resultMap.put("code",1); - try { - List excelRow = new ArrayList<>(); - if(StringUtils.isNotBlank(entName)){ - System.out.println("entName -> "+entName); - System.out.println("file -> "+file.getOriginalFilename()); - Map companyData = this.getCompanyData(file);//错误集合收集 get excelRow - //清单数据 - List listDetails = (List)companyData.get("listDetails"); - //出错数据 - excelRow = (List)companyData.get("excelRow"); - if(null == excelRow ){ - excelRow = new ArrayList<>(); - } - - this.handleEntList(listDetails,excelRow,entName); - }else{ - excelRow.add("请输入企业名"); - } - - - - resultMap.put("excelRow",excelRow); - }catch (Exception e){ - e.printStackTrace(); - } - return resultMap; - } - - /** - * 处理企业清单 - * @param listDetails - * @param excelRow - * @throws Exception - */ - private void handleEntList(List listDetails,List excelRow,String entName)throws Exception{ - if(null != listDetails && listDetails.size() > 0){ - Integer listSort = 1; - - List sysEntLists = new ArrayList<>(); - List sysUserIds = new ArrayList<>(); - - for (ImportListDetail listDetail : listDetails){ - listDetail.setEntName(entName); - listDetail.setListSort(listSort); - System.out.println("listDetail -> "+JSONArray.toJSONString(listDetail)); - String errorMsg = this.addEntList(listDetail,sysEntLists,sysUserIds); - if(StringUtils.isNotBlank(errorMsg)){ - excelRow.add(errorMsg); - } - listSort++ ; - } - - //先删除之前上传的企业清单 - if(null != sysUserIds && sysUserIds.size() > 0 && null != sysEntLists && sysEntLists.size() > 0){ - //删除企业清单 - sysEntListMapper.delByListType(sysEntLists.get(0).getSysenterpriseid(),"",""); - //上传企业清单 - sysEntListMapper.insertList(sysEntLists); - //修改统计数据 - super.changeEntListNum(sysEntLists.get(0).getSysenterpriseid(),"excel"); - } - - - } - } /** * 导入企业清单 diff --git a/inventory-gov/src/main/java/com/rzyc/controller/PcPersonalController.java b/inventory-gov/src/main/java/com/rzyc/controller/PcPersonalController.java index 72507fa..019c5b8 100644 --- a/inventory-gov/src/main/java/com/rzyc/controller/PcPersonalController.java +++ b/inventory-gov/src/main/java/com/rzyc/controller/PcPersonalController.java @@ -66,8 +66,6 @@ public class PcPersonalController extends com.rzyc.controller.BaseController { */ @ApiOperation(value = "PC政府用户登录", notes = "PC政府用户登录") @PostMapping(value = "/pclogin") - /*@PreAuthorize("hasAnyAuthority('pclogin','pclogin:update')") - @MethodAnnotation(authorizations = {"pclogin","pclogin:update"},name = "PC政府用户登录")*/ @ResponseBody public SingleResult pclogin(@Valid LoginDto loginDto,HttpServletRequest request)throws Exception{ SingleResult result = new SingleResult<>(); @@ -453,6 +451,8 @@ public class PcPersonalController extends com.rzyc.controller.BaseController { Integer day = DateUtils.getMonthLastDay(year,month); String startTime = year + "-" + month + "-" + day + " 23:59:59"; + + //任务完成状态 String completeState = ""; if(null != stayMatterDto.getCompleteState()){