From ea4e4401d1436b640bb604146ac5ca2da47d3866 Mon Sep 17 00:00:00 2001 From: "1378012178@qq.com" <1378012178@qq.com> Date: Wed, 11 Feb 2026 16:06:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9C=BA=E6=9E=84=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orgapplyinfo/api/IOrgApplyInfoApi.java | 20 +- .../entity/OrgAllInfoApiEntity.java | 324 ++- .../entity/OrgApplyInfoApiEntity.java | 124 - .../controller/OrgApplyInfoController.java | 60 +- .../orgapplyinfo/entity/OrgAllInfo.java | 4 + .../orgapplyinfo/entity/OrgApplyInfo.java | 120 +- .../mapper/OrgApplyInfoMapper.java | 10 + .../mapper/xml/OrgApplyInfoMapper.xml | 249 ++ .../service/IOrgApplyInfoService.java | 14 +- .../service/impl/OrgApplyInfoServiceImpl.java | 767 ++++-- .../controller/WechatMiniController.java | 3 +- .../listener/WorkOrderMQListener.java | 39 +- .../nu/modules/wechat/elder/api/ElderApi.java | 4 +- .../orgapplyinfo/api/OrgApplyInfoApi.java | 76 +- .../java/com/nu/dto/OrgApplyInfoMQDto.java | 8 +- .../main/java/com/nu/dto/WorkOrderMQDto.java | 49 +- .../main/java/com/nu/utils/NuRedisUtils.java | 2 +- .../jeecg/common/system/api/ISysBaseAPI.java | 6 +- .../common/system/entity/SysDepartEntity.java | 107 + .../system/controller/SysUserController.java | 15 +- .../modules/system/entity/SysDepart.java | 321 ++- .../jeecg/modules/system/entity/SysUser.java | 1 + .../system/service/ISysDepartService.java | 3 + .../system/service/impl/SysBaseApiImpl.java | 26 +- .../service/impl/SysDepartServiceImpl.java | 2324 +++++++++-------- 25 files changed, 2789 insertions(+), 1887 deletions(-) delete mode 100644 nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgApplyInfoApiEntity.java diff --git a/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/api/IOrgApplyInfoApi.java b/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/api/IOrgApplyInfoApi.java index dd8b72f..2677e9b 100644 --- a/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/api/IOrgApplyInfoApi.java +++ b/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/api/IOrgApplyInfoApi.java @@ -2,21 +2,31 @@ package com.nu.modules.orgapplyinfo.api; import com.baomidou.mybatisplus.core.metadata.IPage; import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; -import com.nu.modules.orgapplyinfo.entity.OrgApplyInfoApiEntity; +import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; import java.util.List; public interface IOrgApplyInfoApi { - OrgApplyInfoApiEntity insert(OrgApplyInfoApiEntity orgApplyInfoApiEntity); + OrgAllInfoApiEntity insertApply(OrgAllInfoApiEntity orgApplyInfoApiEntity); - int updateById(OrgApplyInfoApiEntity orgApplyInfoApiEntity); + OrgAllInfoApiEntity insertUpInfo(OrgAllInfoApiEntity orgApplyInfoApiEntity); - List queryAuditInfo(String openId, String id, String status); + int updateById(OrgAllInfoApiEntity orgApplyInfoApiEntity); + + List queryOrgHomePageList(String openId); + + List queryOrgHis(String openId, String optType); IPage queryOrgAllInfo(Integer pageNo, Integer pageSize, String orgCode, String title); List getOrgByOpenId(String id, String status, String openId, String invited, String izHistory); - boolean validateChanged(OrgApplyInfoApiEntity orgApplyInfoApiEntity); + boolean validateApplyChanged(OrgAllInfoApiEntity orgApplyInfoApiEntity); + + boolean validateUpInfoChanged(OrgAllInfoApiEntity orgApplyInfoApiEntity); + + boolean validateComNamerepet(OrgAllInfoApiEntity orgApplyInfoApiEntity); + + OrgAllInfoApiEntity queryOrgInfoById(String id); } diff --git a/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfoApiEntity.java b/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfoApiEntity.java index 615aa0c..dbbbcf2 100644 --- a/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfoApiEntity.java +++ b/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfoApiEntity.java @@ -1,9 +1,15 @@ package com.nu.modules.orgapplyinfo.entity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.Date; /** @@ -110,138 +116,6 @@ public class OrgAllInfoApiEntity implements Serializable { */ private String picUrl; - /** - * 微信id - */ - private String openId; - /** - * 微信名称 - */ - private String wechatName; - /** - * 联系电话 - */ - private String tel; - /** - * 咨询人姓名 - */ - private String name; - /** - * 性别 - */ - private String sex; - /** - * 民族 - */ - private String national; - /** - * 出生日期 - */ - private Date birthDate; - /** - * 住址(身份证上) - */ - private String idCardAddress; - /** - * 身份证号 - */ - private String idCard; - /** - * 签发机关 - */ - private String issuingAuthority; - /** - * 有效开始日期 - */ - private Date startTime; - /** - * 有效结束日期 - */ - private Date endTime; - /** - * 身份证正面 - */ - private String cardZmPath; - /** - * 身份证反面 - */ - private String cardFmPath; - /** - * 营业执照照片 - */ - private String comBusinessLicense; - /** - * 企业名称 - */ - private String comName; - /** - * 企业注册地址 - */ - private String comRegisterAddress; - /** - * 企业信用代码 - */ - private String comCreditCode; - /** - * 企业法人 - */ - private String comLegalPerson; - /** - * 机构地址 - */ - private String orgAddress; - /** - * 机构位置坐标:经度 - */ - private String orgCoordinateLo; - /** - * 机构位置坐标:维度 - */ - private String orgCoordinateLa; - /** - * 机构负责人 - */ - private String orgLeader; - /** - * 机构负责人电话 - */ - private String orgLeaderPhone; - /** - * 机构楼宇牌号 - */ - private String orgBuildingNumber; - /** - * 机构房屋性质 - */ - private String orgPropertyType; - /** - * 机构建筑面积 - */ - private Double orgBuildingArea; - /** - * 机构省份 sys_category.id - */ - private String orgProvince; - /** - * 机构城市 sys_category.id - */ - private String orgCity; - /** - * 机构区域 sys_category.id - */ - private String orgDistrict; - /** - * 合同附件 - */ - private String contract; - /** - * 合同备注 - */ - private String contractNote; - /** - * 加盟时间 - */ - private Date franchiseTime; /** @@ -272,10 +146,6 @@ public class OrgAllInfoApiEntity implements Serializable { * 申请日期 */ private String applyTime; - /** - * 审核日期 - */ - private String auditTime; /** * 员工id */ @@ -305,12 +175,186 @@ public class OrgAllInfoApiEntity implements Serializable { * 护理单元名称 */ private String nuName; - /** - * 信息修改状态 空:没提交过修改 1修改申请中 2通过 3驳回 - */ - private String modifyState; //0历史数据 1当前数据 private String izHistory; + /**id*/ + private String id; + /**pkId 同表id*/ + private String pkId; + /**微信id*/ + private String openId; + /**微信名称*/ + private String wechatName; + /**联系电话*/ + private String tel; + /**状态 1审核中 2审核完成 3驳回 */ + @Dict(dicCode = "org_apply_status") + private String status; + /**变更状态 2变更完成 4变更申请中 5变更驳回 */ + private java.lang.String modifyStatus; + /**审核备注*/ + private String content; + /**创建人*/ + private String createBy; + /**创建日期*/ + private Date createTime; + /**更新人*/ + private String updateBy; + /**更新日期*/ + private Date updateTime; + /**机构是否入驻0否 1是(是否入驻过)*/ + private String izEntry; + /**咨询人姓名*/ + private String name; + /**性别*/ + private String sex; + /**民族*/ + private String national; + /**出生日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy年MM月dd日") + @DateTimeFormat(pattern="yyyy年MM月dd日") + private Date birthDate; + /**住址(身份证上)*/ + private String idCardAddress; + /**身份证号*/ + private String idCard; + /**签发机关*/ + private String issuingAuthority; + /**有效开始日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy.MM.dd") + @DateTimeFormat(pattern = "yyyy.MM.dd") + private Date startTime; + /**有效结束日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy.MM.dd") + @DateTimeFormat(pattern = "yyyy.MM.dd") + private Date endTime; + /**身份证正面*/ + private String cardZmPath; + /**身份证反面*/ + private String cardFmPath; + /**营业执照照片*/ + private String comBusinessLicense; + /**企业名称*/ + private String comName; + /**企业注册地址*/ + private String comRegisterAddress; + /**企业信用代码*/ + private String comCreditCode; + /**企业法人*/ + private String comLegalPerson; + /**机构地址*/ + private String orgAddress; + /**机构位置坐标:经度*/ + private String orgCoordinateLo; + /**机构位置坐标:纬度*/ + private String orgCoordinateLa; + /**机构负责人*/ + private String orgLeader; + /**机构负责人电话*/ + private String orgLeaderPhone; + /**机构楼宇牌号*/ + private String orgBuildingNumber; + /**机构房屋性质*/ + private String orgPropertyType; + /**机构建筑面积*/ + private Double orgBuildingArea; + /**机构省份 sys_category.id*/ + @Dict(dictTable = "sys_category",dicCode = "id",dicText = "name") + private java.lang.String orgProvince; + private java.lang.String orgProvince_dictText; + /**机构城市 sys_category.id*/ + @Dict(dictTable = "sys_category",dicCode = "id",dicText = "name") + private java.lang.String orgCity; + private java.lang.String orgCity_dictText; + /**机构区域 sys_category.id*/ + @Dict(dictTable = "sys_category",dicCode = "id",dicText = "name") + private java.lang.String orgDistrict; + private java.lang.String orgDistrict_dictText; + private java.util.Date commitTime;//提交时间 + private java.util.Date auditTime;//审核时间 + + /**审核人*/ + @Dict(dicCode = "username" , dicText = "realname" ,dictTable = "sys_user") + @ApiModelProperty(value = "审核人") + private String auditBy; + /**操作类型 rz 入驻 bg变更*/ + @Excel(name = "操作类型 rz 入驻 bg变更", width = 15) + @ApiModelProperty(value = "操作类型 rz 入驻 bg变更") + private java.lang.String optType; + /**操作类型中文名称*/ + @Excel(name = "操作类型", width = 15) + @ApiModelProperty(value = "操作类型") + private java.lang.String optTypeName; + + /** + * 加盟时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "加盟时间") + private java.util.Date franchiseTime; + /** + * 机构状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】 + */ + @Dict(dicCode = "org_build_status") + @Excel(name = "机构状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】", width = 15) + @ApiModelProperty(value = "机构状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】") + private java.lang.String orgStatus; + /** + * 合同提交时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "合同提交时间") + private java.util.Date htCommitTime; + /** + * 合同提交人 + */ + @Excel(name = "合同提交人", width = 15) + @ApiModelProperty(value = "合同提交人") + private java.lang.String htCommitBy; + /** + * 合同附件 + */ + @Excel(name = "合同附件", width = 15) + @ApiModelProperty(value = "合同附件") + private java.lang.String contract; + /** + * 合同备注 + */ + @Excel(name = "合同备注", width = 15) + @ApiModelProperty(value = "合同备注") + private java.lang.String contractNote; + + /** + * 工单状态 0未提交 1待执行 2已回执 + */ + @Dict(dicCode = "work_order_status") + private java.lang.String workOrderStatus; + /** + * 工单ID + */ + private java.lang.String workOrderId; + /** + * 回复内容 + */ + private java.lang.String replyContent; + /** + * 回复附件 + */ + private java.lang.String replyFile; + /** + * 回复时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private java.util.Date replyTime; + /** + * 回复人 + */ + private java.lang.String handleBy; + + } diff --git a/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgApplyInfoApiEntity.java b/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgApplyInfoApiEntity.java deleted file mode 100644 index 6542ab7..0000000 --- a/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgApplyInfoApiEntity.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.nu.modules.orgapplyinfo.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecg.common.aspect.annotation.Dict; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; -import java.time.LocalDate; -import java.util.Date; - -/** - * @Description: 机构加盟申请信息表 - * @Author: 张明远 - * @Date: 2025-06-05 - * @Version: V1.0 - */ -@Data -public class OrgApplyInfoApiEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /**id*/ - private String id; - /**pkId 同表id*/ - private String pkId; - /**微信id*/ - private String openId; - /**微信名称*/ - private String wechatName; - /**联系电话*/ - private String tel; - /**状态 1审核中 2审核完成 3驳回 */ - private String status; - /**变更状态 2变更完成 4变更申请中 5变更驳回 */ - private java.lang.String modifyStatus; - /**审核备注*/ - private String content; - /**创建人*/ - private String createBy; - /**创建日期*/ - private Date createTime; - /**更新人*/ - private String updateBy; - /**更新日期*/ - private Date updateTime; - /**机构是否入驻0否 1是(是否入驻过)*/ - private String izEntry; - /**咨询人姓名*/ - private String name; - /**性别*/ - private String sex; - /**民族*/ - private String national; - /**出生日期*/ - @JsonFormat(pattern = "yyyy年MM月dd日") - @DateTimeFormat(pattern = "yyyy年MM月dd日") - private LocalDate birthDate; - /**住址(身份证上)*/ - private String idCardAddress; - /**身份证号*/ - private String idCard; - /**签发机关*/ - private String issuingAuthority; - /**有效开始日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy.MM.dd") - @DateTimeFormat(pattern = "yyyy.MM.dd") - private Date startTime; - /**有效结束日期*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy.MM.dd") - @DateTimeFormat(pattern = "yyyy.MM.dd") - private Date endTime; - /**身份证正面*/ - private String cardZmPath; - /**身份证反面*/ - private String cardFmPath; - /**营业执照照片*/ - private String comBusinessLicense; - /**企业名称*/ - private String comName; - /**企业注册地址*/ - private String comRegisterAddress; - /**企业信用代码*/ - private String comCreditCode; - /**企业法人*/ - private String comLegalPerson; - /**机构地址*/ - private String orgAddress; - /**机构位置坐标:经度*/ - private String orgCoordinateLo; - /**机构位置坐标:纬度*/ - private String orgCoordinateLa; - /**机构负责人*/ - private String orgLeader; - /**机构负责人电话*/ - private String orgLeaderPhone; - /**机构楼宇牌号*/ - private String orgBuildingNumber; - /**机构房屋性质*/ - private String orgPropertyType; - /**机构建筑面积*/ - private Double orgBuildingArea; - /**机构省份 sys_category.id*/ - private java.lang.String orgProvince; - private java.lang.String orgProvince_dictText; - /**机构城市 sys_category.id*/ - private java.lang.String orgCity; - private java.lang.String orgCity_dictText; - /**机构区域 sys_category.id*/ - private java.lang.String orgDistrict; - private java.lang.String orgDistrict_dictText; - private java.util.Date commitTime;//提交时间 - private java.util.Date auditTime;//审核时间 - private java.util.Date franchiseTime;//加盟时间 - -} diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/controller/OrgApplyInfoController.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/controller/OrgApplyInfoController.java index 0922b36..fdad108 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/controller/OrgApplyInfoController.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/controller/OrgApplyInfoController.java @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.nu.modules.orgapplyinfo.entity.OrgAllInfo; +import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; import org.apache.commons.lang.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; @@ -31,6 +32,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -68,10 +70,21 @@ public class OrgApplyInfoController extends JeecgController> queryPageList(OrgApplyInfo orgApplyInfo, - @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, - HttpServletRequest req) { + public Result> queryPageList(OrgApplyInfo orgApplyInfo, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Page page = new Page(pageNo, pageSize); + IPage pageList = orgApplyInfoService.pageList(orgApplyInfo, page); + return Result.OK(pageList); + } + + @ApiOperation(value = "机构加盟申请审核-审核历史", notes = "机构加盟申请审核-审核历史") + @GetMapping(value = "/hisList") + public Result> hisList(OrgApplyInfo orgApplyInfo, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { // 自定义查询规则 Map customeRuleMap = new HashMap<>(); // 自定义多选的查询规则为:LIKE_WITH_OR @@ -87,7 +100,6 @@ public class OrgApplyInfoController extends JeecgController edit(@RequestBody OrgApplyInfo orgApplyInfo) { - orgApplyInfoService.audit(orgApplyInfo); + @AutoLog(value = "机构加盟申请-加盟审批") + @ApiOperation(value = "机构加盟申请-加盟审批", notes = "机构加盟申请-加盟审批") + @RequestMapping(value = "/applyAudit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result applyAudit(@RequestBody OrgAllInfoApiEntity dto) { + OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); + BeanUtils.copyProperties(dto,orgApplyInfo); + orgApplyInfoService.applyAudit(orgApplyInfo); return Result.OK("审核完成!"); } + /** + * 信息变更审批 + * + * @param dto + * @return + */ + @AutoLog(value = "机构加盟申请-信息变更审批") + @ApiOperation(value = "机构加盟申请-信息变更审批", notes = "机构加盟申请-信息变更审批") + @RequestMapping(value = "/upInfoAudit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result upInfoAudit(@RequestBody OrgAllInfoApiEntity dto) { + OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); + BeanUtils.copyProperties(dto,orgApplyInfo); + orgApplyInfoService.upInfoAudit(orgApplyInfo); + return Result.OK("审核完成!"); + } @AutoLog(value = "上传合同-保存为草稿") @ApiOperation(value = "上传合同-保存为草稿", notes = "上传合同-保存为草稿") @RequiresPermissions("orgapplyinfo:nu_org_apply_info:edit") @RequestMapping(value = "/editCg", method = {RequestMethod.PUT, RequestMethod.POST}) - public Result editCg(@RequestBody OrgApplyInfo orgApplyInfo) { - orgApplyInfoService.audit(orgApplyInfo); + public Result editCg(@RequestBody OrgAllInfoApiEntity orgApplyInfo) { + orgApplyInfoService.saveCg(orgApplyInfo); return Result.OK("操作完成!"); } @@ -138,7 +166,7 @@ public class OrgApplyInfoController extends JeecgController submitContract(@RequestBody OrgApplyInfo orgApplyInfo) { + public Result submitContract(@RequestBody OrgAllInfoApiEntity orgApplyInfo) { orgApplyInfoService.submitContract(orgApplyInfo); return Result.OK("提交成功!"); } diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfo.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfo.java index 9c5459c..e18fe8d 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfo.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfo.java @@ -1,7 +1,9 @@ package com.nu.modules.orgapplyinfo.entity; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.jeecg.common.aspect.annotation.Dict; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.math.BigDecimal; @@ -121,6 +123,8 @@ public class OrgAllInfo implements Serializable { /**民族*/ private String national; /**出生日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy年MM月dd日") + @DateTimeFormat(pattern="yyyy年MM月dd日") private Date birthDate; /**住址(身份证上)*/ private String idCardAddress; diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgApplyInfo.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgApplyInfo.java index 650a776..ae1db6b 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgApplyInfo.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgApplyInfo.java @@ -16,6 +16,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.time.LocalDate; +import java.util.Date; /** * @Description: 机构加盟申请信息表 @@ -24,7 +25,7 @@ import java.time.LocalDate; * @Version: V1.0 */ @Data -@TableName("nu_org_apply_info") +@TableName("nu_org_apply_info_new") @Accessors(chain = true) @EqualsAndHashCode(callSuper = false) @ApiModel(value="nu_org_apply_info对象", description="机构加盟申请信息表") @@ -50,29 +51,6 @@ public class OrgApplyInfo implements Serializable { @Excel(name = "联系电话", width = 15) @ApiModelProperty(value = "联系电话") private java.lang.String tel; - /**状态 1审核中 2审核完成 3驳回 */ - @Dict(dicCode = "org_apply_status") - @Excel(name = "审批状态", width = 15) - @ApiModelProperty(value = "审批状态") - private java.lang.String status; - /**变更状态 0可修改 1不可修改 */ - @Excel(name = "变更状态 0可修改 1不可修改", width = 15) - @ApiModelProperty(value = "变更状态 0可修改 1不可修改") - private java.lang.String modifyStatus; - /**构建状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】*/ - @Dict(dicCode = "org_build_status") - @Excel(name = "构建状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】", width = 15) - @ApiModelProperty(value = "构建状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】") - private java.lang.String buildStatus; - - //构建状态前后台处理逻辑字段 - @TableField(exist = false) - private String buildStatusVal; - - /**审核备注*/ - @Excel(name = "审核备注", width = 15) - @ApiModelProperty(value = "审核备注") - private java.lang.String content; /**创建人*/ @ApiModelProperty(value = "创建人") private java.lang.String createBy; @@ -89,10 +67,6 @@ public class OrgApplyInfo implements Serializable { @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "更新日期") private java.util.Date updateTime; - /**机构是否入驻0否 1是(是否入驻过)*/ - @Excel(name = "机构是否入驻0否 1是(是否入驻过)", width = 15) - @ApiModelProperty(value = "机构是否入驻0否 1是(是否入驻过)") - private java.lang.String izEntry; /**咨询人姓名*/ @Excel(name = "咨询人姓名", width = 15) @ApiModelProperty(value = "咨询人姓名") @@ -106,11 +80,11 @@ public class OrgApplyInfo implements Serializable { @ApiModelProperty(value = "民族") private java.lang.String national; /**出生日期*/ - @Excel(name = "出生日期", width = 20, format = "yyyy-MM-dd") - @JsonFormat(pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") + @Excel(name = "出生日期", width = 20, format = "yyyy年MM月dd日") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy年MM月dd日") + @DateTimeFormat(pattern="yyyy年MM月dd日") @ApiModelProperty(value = "出生日期") - private LocalDate birthDate; + private java.util.Date birthDate; /**住址(身份证上)*/ @Excel(name = "住址(身份证上)", width = 15) @ApiModelProperty(value = "住址(身份证上)") @@ -210,14 +184,38 @@ public class OrgApplyInfo implements Serializable { @ApiModelProperty(value = "机构区域") @Dict(dictTable = "sys_category",dicCode = "id",dicText = "name") private java.lang.String orgDistrict; - /**合同附件*/ - @Excel(name = "合同附件", width = 15) - @ApiModelProperty(value = "合同附件") - private java.lang.String contract; - /**合同备注*/ - @Excel(name = "合同备注", width = 15) - @ApiModelProperty(value = "合同备注") - private java.lang.String contractNote; + /**状态 1审核中 2审核完成 3驳回 */ + @Dict(dicCode = "org_apply_status") + @Excel(name = "审批状态", width = 15) + @ApiModelProperty(value = "审批状态") + private java.lang.String status; + /**审核备注*/ + @Excel(name = "审核备注", width = 15) + @ApiModelProperty(value = "审核备注") + private java.lang.String content; + /**审核时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "审核时间") + private java.util.Date auditTime; + /**审核人*/ + @Dict(dicCode = "username" , dicText = "realname" ,dictTable = "sys_user") + @ApiModelProperty(value = "审核人") + private String auditBy; + /**是否历史数据*/ + @Excel(name = "是否历史数据", width = 15) + @ApiModelProperty(value = "是否历史数据") + private java.lang.String izHistory; + /**操作类型 rz 入驻 bg变更*/ + @Excel(name = "操作类型 rz 入驻 bg变更", width = 15) + @ApiModelProperty(value = "操作类型 rz 入驻 bg变更") + private java.lang.String optType; + /**操作类型中文名称*/ + @Excel(name = "操作类型", width = 15) + @ApiModelProperty(value = "操作类型") + private java.lang.String optTypeName; + + @TableField(exist = false) private java.lang.String orgProvince_dictText; @TableField(exist = false) @@ -225,38 +223,16 @@ public class OrgApplyInfo implements Serializable { @TableField(exist = false) private java.lang.String orgDistrict_dictText; - /**提交时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "提交时间") - private java.util.Date commitTime; - - /**审核时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "审核时间") - private java.util.Date auditTime; - @Dict(dicCode = "username" , dicText = "realname" ,dictTable = "sys_user") - private String auditBy; - - /**加盟时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - @ApiModelProperty(value = "加盟时间") - private java.util.Date franchiseTime; - - private java.lang.String replyContent; - private java.lang.String replyFile; - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") - private java.util.Date replyTime; - private java.lang.String handleBy; - @Dict(dicCode = "work_order_status") - private java.lang.String workOrderStatus; - private java.lang.String workOrderId; - @TableField(exist = false) private String title; - - + /**创建日期起始*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @TableField(exist = false) + private java.util.Date createTimeStart; + /**创建日期截止*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @TableField(exist = false) + private java.util.Date createTimeEnd; } diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/mapper/OrgApplyInfoMapper.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/mapper/OrgApplyInfoMapper.java index 2680867..a2b5027 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/mapper/OrgApplyInfoMapper.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/mapper/OrgApplyInfoMapper.java @@ -3,7 +3,9 @@ package com.nu.modules.orgapplyinfo.mapper; import java.util.List; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.nu.modules.orgapplyinfo.entity.OrgAllInfo; +import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; import org.apache.ibatis.annotations.Param; import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -21,4 +23,12 @@ public interface OrgApplyInfoMapper extends BaseMapper { IPage queryOrgInfo(@Param("page") IPage page, @Param("orgCode") String orgCode, @Param("title") String title); IPage getOrgByOpenId(IPage page, @Param("id") String id, @Param("openId") String openId, @Param("status") String status, @Param("invited") String invited, @Param("izHistory") String izHistory); + + int validateSysDepartComNamerepet(@Param("dto") OrgAllInfoApiEntity orgApplyInfoApiEntity); + + int validateApplyOrgComNamerepet(@Param("dto") OrgAllInfoApiEntity orgApplyInfoApiEntity); + + IPage pageList(@Param("dto") OrgApplyInfo orgApplyInfo, @Param("page") Page page); + + List orgList(@Param("dto") OrgApplyInfo orgApplyInfo); } diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/mapper/xml/OrgApplyInfoMapper.xml b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/mapper/xml/OrgApplyInfoMapper.xml index 7c02b9a..ff0200f 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/mapper/xml/OrgApplyInfoMapper.xml +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/mapper/xml/OrgApplyInfoMapper.xml @@ -126,6 +126,255 @@ order by eo.create_time DESC + + + + + + diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/IOrgApplyInfoService.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/IOrgApplyInfoService.java index 73c0173..346497f 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/IOrgApplyInfoService.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/IOrgApplyInfoService.java @@ -1,7 +1,9 @@ package com.nu.modules.orgapplyinfo.service; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.nu.modules.orgapplyinfo.entity.OrgAllInfo; +import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo; import com.baomidou.mybatisplus.extension.service.IService; @@ -18,11 +20,17 @@ public interface IOrgApplyInfoService extends IService { List> getModifyInfo(OrgApplyInfo orgApplyInfo); - void audit(OrgApplyInfo orgApplyInfo); + void applyAudit(OrgApplyInfo orgApplyInfo); - void submitContract(OrgApplyInfo orgApplyInfo); + void saveCg(OrgAllInfoApiEntity orgApplyInfo); + + void submitContract(OrgAllInfoApiEntity orgApplyInfo); IPage queryOrgInfo(IPage page, String orgCode, String title); - IPage getOrgByOpenId(IPage page, String openId); + IPage getOrgByOpenId(IPage page, String openId); + + void upInfoAudit(OrgApplyInfo orgApplyInfo); + + IPage pageList(OrgApplyInfo orgApplyInfo, Page page); } diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/impl/OrgApplyInfoServiceImpl.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/impl/OrgApplyInfoServiceImpl.java index a170c67..7026383 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/impl/OrgApplyInfoServiceImpl.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/orgapplyinfo/service/impl/OrgApplyInfoServiceImpl.java @@ -1,6 +1,7 @@ package com.nu.modules.orgapplyinfo.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -17,19 +18,24 @@ import com.nu.modules.orgapplyinfo.api.IOrgApplyInfoApi; import com.nu.modules.orgapplyinfo.entity.OrgAllInfo; import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo; -import com.nu.modules.orgapplyinfo.entity.OrgApplyInfoApiEntity; +import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; import com.nu.modules.orgapplyinfo.mapper.OrgApplyInfoMapper; import com.nu.modules.orgapplyinfo.service.IOrgApplyInfoService; import com.nu.modules.wxnotice.IWxNoticeApi; import com.nu.utils.DictUtils; import com.nu.utils.RabbitMQUtil; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang.StringUtils; import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.api.ISysBaseAPI; +import org.jeecg.common.system.entity.SysDepartEntity; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.system.vo.SysDepartModel; import org.jeecg.modules.base.service.BaseCommonService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.lang.reflect.Field; import java.text.SimpleDateFormat; @@ -48,91 +54,207 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl uw = new UpdateWrapper<>(); + uw.eq("pk_id", orgApplyInfoApiEntity.getPkId()); + baseMapper.update(upData, uw); + } + + //插入新数据 + String id = IdUtil.simpleUUID(); OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); - BeanUtils.copyProperties(orgApplyInfoApiEntity, orgApplyInfo); - orgApplyInfo.setCreateTime(new Date()); - orgApplyInfo.setCommitTime(new Date()); - orgApplyInfo.setAuditTime(null); - orgApplyInfo.setContent(null); + orgApplyInfo.setId(id); + //第一次入驻申请时用id作为pkid 否则入驻申请前端都会把旧的pkid传进来 + if (StringUtils.isBlank(orgApplyInfo.getPkId())) { + orgApplyInfo.setPkId(id); + } else { + orgApplyInfo.setPkId(orgApplyInfoApiEntity.getPkId()); + } + //机构信息 + orgApplyInfo.setOpenId(orgApplyInfoApiEntity.getOpenId());//openid + orgApplyInfo.setTel(orgApplyInfoApiEntity.getTel());//联系电话 + orgApplyInfo.setWechatName(orgApplyInfo.getWechatName());//微信名称(空字段) + orgApplyInfo.setName(orgApplyInfoApiEntity.getName());//咨询人姓名 + orgApplyInfo.setSex(orgApplyInfoApiEntity.getSex());//性别 + orgApplyInfo.setNational(orgApplyInfoApiEntity.getNational());//民族 + orgApplyInfo.setBirthDate(orgApplyInfoApiEntity.getBirthDate());//出生日期 + orgApplyInfo.setIdCardAddress(orgApplyInfoApiEntity.getIdCardAddress());//住址 + orgApplyInfo.setIdCard(orgApplyInfoApiEntity.getIdCard());//身份证号 + orgApplyInfo.setIssuingAuthority(orgApplyInfoApiEntity.getIssuingAuthority());//签发机关 + orgApplyInfo.setStartTime(orgApplyInfoApiEntity.getStartTime());//身份证有效开始日期 + orgApplyInfo.setEndTime(orgApplyInfoApiEntity.getEndTime());//身份证有效结束日期 + orgApplyInfo.setCardZmPath(orgApplyInfoApiEntity.getCardZmPath());//身份证照片人像面 + orgApplyInfo.setCardFmPath(orgApplyInfoApiEntity.getCardFmPath());//身份证照片国徽面 + orgApplyInfo.setComBusinessLicense(orgApplyInfoApiEntity.getComBusinessLicense());//营业执照照片 + orgApplyInfo.setComName(orgApplyInfoApiEntity.getComName());//企业名称 + orgApplyInfo.setComRegisterAddress(orgApplyInfoApiEntity.getComRegisterAddress());//企业注册地址 + orgApplyInfo.setComCreditCode(orgApplyInfoApiEntity.getComCreditCode());//企业信用代码 + orgApplyInfo.setComLegalPerson(orgApplyInfoApiEntity.getComLegalPerson());//企业法人 + orgApplyInfo.setOrgAddress(orgApplyInfoApiEntity.getOrgAddress());//机构地址 + orgApplyInfo.setOrgCoordinateLo(orgApplyInfoApiEntity.getOrgCoordinateLo());//机构位置坐标:经度 + orgApplyInfo.setOrgCoordinateLa(orgApplyInfoApiEntity.getOrgCoordinateLa());//机构位置坐标:维度 + orgApplyInfo.setOrgLeader(orgApplyInfoApiEntity.getOrgLeader());//机构负责人 + orgApplyInfo.setOrgLeaderPhone(orgApplyInfoApiEntity.getOrgLeaderPhone());//机构负责人电话 + orgApplyInfo.setOrgBuildingNumber(orgApplyInfoApiEntity.getOrgBuildingNumber());//机构楼宇牌号 + orgApplyInfo.setOrgPropertyType(orgApplyInfoApiEntity.getOrgPropertyType());//机构房屋性质 + orgApplyInfo.setOrgBuildingArea(orgApplyInfoApiEntity.getOrgBuildingArea());//机构建筑面积 + orgApplyInfo.setOrgProvince(orgApplyInfoApiEntity.getOrgProvince());//机构省份 + orgApplyInfo.setOrgCity(orgApplyInfoApiEntity.getOrgCity());//机构城市 + orgApplyInfo.setOrgDistrict(orgApplyInfoApiEntity.getOrgDistrict());//机构区域 + //状态字段 + orgApplyInfo.setIzHistory("N");//当前机构动态数据 + orgApplyInfo.setStatus("1");//入驻申请 + orgApplyInfo.setOptType("rz"); + orgApplyInfo.setOptTypeName("入驻"); baseMapper.insert(orgApplyInfo); orgApplyInfoApiEntity.setId(orgApplyInfo.getId()); - - if (StringUtils.isBlank(orgApplyInfo.getPkId())) { - orgApplyInfo.setPkId(orgApplyInfo.getId()); - baseMapper.updateById(orgApplyInfo); - } - if ("4".equals(orgApplyInfo.getStatus())) { - //先将历史审核不通过的数据删除掉 - baseMapper.realDelete(orgApplyInfo.getPkId()); - - //如果是提交机构变更 需要将对应pkid都改为 modify_status=1 不可提交修改信息 - QueryWrapper qw = new QueryWrapper<>(); - qw.eq("pk_id", orgApplyInfo.getPkId()); -// qw.eq("status", "2"); - OrgApplyInfo updateData = new OrgApplyInfo(); - updateData.setModifyStatus("1"); - baseMapper.update(updateData, qw); - } return orgApplyInfoApiEntity; } @Override - public int updateById(OrgApplyInfoApiEntity orgApplyInfoApiEntity) { + public OrgAllInfoApiEntity insertUpInfo(OrgAllInfoApiEntity orgApplyInfoApiEntity) { + //非第一次入驻申请 先将相同PKID都变更为历史 + if (StringUtils.isNotBlank(orgApplyInfoApiEntity.getPkId())) { + OrgApplyInfo upData = new OrgApplyInfo(); + upData.setIzHistory("Y"); + UpdateWrapper uw = new UpdateWrapper<>(); + uw.eq("pk_id", orgApplyInfoApiEntity.getPkId()); + baseMapper.update(upData, uw); + } + + //插入新数据 + OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); + orgApplyInfo.setId(IdUtil.simpleUUID()); + orgApplyInfo.setPkId(orgApplyInfoApiEntity.getPkId()); + //机构信息 + orgApplyInfo.setOpenId(orgApplyInfoApiEntity.getOpenId());//openid + orgApplyInfo.setTel(orgApplyInfoApiEntity.getTel());//联系电话 + orgApplyInfo.setWechatName(orgApplyInfo.getWechatName());//微信名称(空字段) + orgApplyInfo.setName(orgApplyInfoApiEntity.getName());//咨询人姓名 + orgApplyInfo.setSex(orgApplyInfoApiEntity.getSex());//性别 + orgApplyInfo.setNational(orgApplyInfoApiEntity.getNational());//民族 + orgApplyInfo.setBirthDate(orgApplyInfoApiEntity.getBirthDate());//出生日期 + orgApplyInfo.setIdCardAddress(orgApplyInfoApiEntity.getIdCardAddress());//住址 + orgApplyInfo.setIdCard(orgApplyInfoApiEntity.getIdCard());//身份证号 + orgApplyInfo.setIssuingAuthority(orgApplyInfoApiEntity.getIssuingAuthority());//签发机关 + orgApplyInfo.setStartTime(orgApplyInfoApiEntity.getStartTime());//身份证有效开始日期 + orgApplyInfo.setEndTime(orgApplyInfoApiEntity.getEndTime());//身份证有效结束日期 + orgApplyInfo.setCardZmPath(orgApplyInfoApiEntity.getCardZmPath());//身份证照片人像面 + orgApplyInfo.setCardFmPath(orgApplyInfoApiEntity.getCardFmPath());//身份证照片国徽面 + orgApplyInfo.setComBusinessLicense(orgApplyInfoApiEntity.getComBusinessLicense());//营业执照照片 + orgApplyInfo.setComName(orgApplyInfoApiEntity.getComName());//企业名称 + orgApplyInfo.setComRegisterAddress(orgApplyInfoApiEntity.getComRegisterAddress());//企业注册地址 + orgApplyInfo.setComCreditCode(orgApplyInfoApiEntity.getComCreditCode());//企业信用代码 + orgApplyInfo.setComLegalPerson(orgApplyInfoApiEntity.getComLegalPerson());//企业法人 + orgApplyInfo.setOrgAddress(orgApplyInfoApiEntity.getOrgAddress());//机构地址 + orgApplyInfo.setOrgCoordinateLo(orgApplyInfoApiEntity.getOrgCoordinateLo());//机构位置坐标:经度 + orgApplyInfo.setOrgCoordinateLa(orgApplyInfoApiEntity.getOrgCoordinateLa());//机构位置坐标:维度 + orgApplyInfo.setOrgLeader(orgApplyInfoApiEntity.getOrgLeader());//机构负责人 + orgApplyInfo.setOrgLeaderPhone(orgApplyInfoApiEntity.getOrgLeaderPhone());//机构负责人电话 + orgApplyInfo.setOrgBuildingNumber(orgApplyInfoApiEntity.getOrgBuildingNumber());//机构楼宇牌号 + orgApplyInfo.setOrgPropertyType(orgApplyInfoApiEntity.getOrgPropertyType());//机构房屋性质 + orgApplyInfo.setOrgBuildingArea(orgApplyInfoApiEntity.getOrgBuildingArea());//机构建筑面积 + orgApplyInfo.setOrgProvince(orgApplyInfoApiEntity.getOrgProvince());//机构省份 + orgApplyInfo.setOrgCity(orgApplyInfoApiEntity.getOrgCity());//机构城市 + orgApplyInfo.setOrgDistrict(orgApplyInfoApiEntity.getOrgDistrict());//机构区域 + //状态字段 + orgApplyInfo.setIzHistory("N");//当前机构动态数据 + orgApplyInfo.setStatus("1");//变更申请 + orgApplyInfo.setOptType("bg"); + orgApplyInfo.setOptTypeName("变更"); + baseMapper.insert(orgApplyInfo); + orgApplyInfoApiEntity.setId(orgApplyInfo.getId()); + return orgApplyInfoApiEntity; + } + + @Override + public int updateById(OrgAllInfoApiEntity orgApplyInfoApiEntity) { OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); BeanUtils.copyProperties(orgApplyInfoApiEntity, orgApplyInfo); return baseMapper.updateById(orgApplyInfo); } @Override - public List queryAuditInfo(String openId, String id, String status) { + public List queryOrgHomePageList(String openId) { + //已经申请通过的机构 查这个表是因为需要最新的机构数据 apply的数据可能是变更中的数据 + SysDepartEntity queryParams = new SysDepartEntity(); + queryParams.setOpenId(openId); + List orgApplyInfoApiEntities = BeanUtil.copyToList(sysBaseAPI.queryAllAuditPassOrg(queryParams), OrgAllInfoApiEntity.class); + if (!CollectionUtils.isEmpty(orgApplyInfoApiEntities)) { + orgApplyInfoApiEntities.stream().forEach(item -> { + item.setPkId(item.getId()); + item.setStatus("2"); + }); + } + //申请中或被驳回的机构 QueryWrapper qw = new QueryWrapper<>(); qw.eq("open_id", openId); - if (StringUtils.isNotBlank(id)) { - qw.eq("id", id); - } - if (StringUtils.isNotBlank(status)) { - qw.in("status", status.split(",")); - } + qw.eq("iz_history", "N"); + qw.eq("opt_type", "rz"); + qw.in("status", "1,3".split(",")); qw.orderByDesc("create_time"); - List list = baseMapper.selectList(qw); + List applyList = BeanUtil.copyToList(baseMapper.selectList(qw), OrgAllInfoApiEntity.class); + orgApplyInfoApiEntities.addAll(applyList); - for (OrgApplyInfo par : list) { + for (OrgAllInfoApiEntity par : orgApplyInfoApiEntities) { par.setOrgProvince_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgProvince())); par.setOrgCity_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgCity())); par.setOrgDistrict_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgDistrict())); } - List result = BeanUtil.copyToList(list, OrgApplyInfoApiEntity.class); - return result; + return orgApplyInfoApiEntities; } + /** + * 查询机构入驻/信息变更历史 + * + * @param openId + * @return + */ + @Override + public List queryOrgHis(String openId, String optType) { + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("open_id", openId); + qw.in("opt_type", optType.split(",")); + qw.orderByDesc("create_time"); + List list = BeanUtil.copyToList(baseMapper.selectList(qw), OrgAllInfoApiEntity.class); + for (OrgAllInfoApiEntity par : list) { + par.setOrgProvince_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgProvince())); + par.setOrgCity_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgCity())); + par.setOrgDistrict_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgDistrict())); + } + return list; + } + @Override public List> getModifyInfo(OrgApplyInfo orgApplyInfo) { - // 1. 查询数据库获取两条记录 + // 1. 修改后的数据 QueryWrapper qw = new QueryWrapper<>(); qw.eq("pk_id", orgApplyInfo.getPkId()); - qw.orderByDesc("create_time"); - qw.in("status", new String[]{"2", "4"}); - List list = baseMapper.selectList(qw); + qw.eq("iz_history", "N"); + qw.eq("status", "1"); + qw.eq("opt_type", "bg"); + OrgApplyInfo modifyData = baseMapper.selectOne(qw);// 修改后的数据 - if (list == null || list.size() < 2) { - return Collections.emptyList(); - } - - OrgApplyInfo modifyData = list.get(0); // 修改后的数据 - OrgApplyInfo usingData = list.get(1); // 原始数据 + OrgApplyInfo usingData = new OrgApplyInfo(); // 原始数据 + SysDepartEntity sysDepartEntity = sysBaseAPI.selectDepartById(orgApplyInfo.getPkId()); + BeanUtils.copyProperties(sysDepartEntity, usingData); // 2. 准备结果列表 List> result = new ArrayList<>(); @@ -185,35 +307,244 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl qw = new QueryWrapper<>(); - qw.eq("pk_id", orgApplyInfo.getPkId()); + qw.eq("opt_type", "rz"); qw.eq("status", "2"); - OrgApplyInfo o_ = baseMapper.selectOne(qw); - //把上一条数据设置为历史数据 同时变更“信息变更状态” - o_.setModifyStatus("2"); - o_.setStatus("0"); - baseMapper.updateById(o_); - - //将变更后数据设置为正在使用的数据 - orgApplyInfo.setStatus("2"); - orgApplyInfo.setFranchiseTime(o_.getFranchiseTime()); - baseMapper.updateById(orgApplyInfo); - - //将同pkid的可修改状态改为可修改 - qw = new QueryWrapper<>(); + qw.eq("iz_history", "N"); qw.eq("pk_id", orgApplyInfo.getPkId()); - OrgApplyInfo upData_ = new OrgApplyInfo(); - upData_.setModifyStatus("0"); - baseMapper.update(upData_, qw); + OrgApplyInfo rzApplyInfo = baseMapper.selectOne(qw); + orgApplyInfoMQDto.setAuditBy(rzApplyInfo.getAuditBy()); + orgApplyInfoMQDto.setAuditTime(rzApplyInfo.getAuditTime()); + } + //基本信息 + orgApplyInfoMQDto.setTel(usingData.getTel());//联系电话 + orgApplyInfoMQDto.setWechatName(usingData.getWechatName());//微信名称(空字段) + orgApplyInfoMQDto.setName(usingData.getName());//咨询人姓名 + orgApplyInfoMQDto.setSex(usingData.getSex());//性别 + orgApplyInfoMQDto.setNational(usingData.getNational());//民族 + orgApplyInfoMQDto.setBirthDate(usingData.getBirthDate());//出生日期 + orgApplyInfoMQDto.setIdCardAddress(usingData.getIdCardAddress());//住址 + orgApplyInfoMQDto.setIdCard(usingData.getIdCard());//身份证号 + orgApplyInfoMQDto.setIssuingAuthority(usingData.getIssuingAuthority());//签发机关 + orgApplyInfoMQDto.setStartTime(usingData.getStartTime());//身份证有效开始日期 + orgApplyInfoMQDto.setEndTime(usingData.getEndTime());//身份证有效结束日期 + orgApplyInfoMQDto.setCardZmPath(usingData.getCardZmPath());//身份证照片人像面 + orgApplyInfoMQDto.setCardFmPath(usingData.getCardFmPath());//身份证照片国徽面 + orgApplyInfoMQDto.setComBusinessLicense(usingData.getComBusinessLicense());//营业执照照片 + orgApplyInfoMQDto.setComName(usingData.getComName());//企业名称 + orgApplyInfoMQDto.setComRegisterAddress(usingData.getComRegisterAddress());//企业注册地址 + orgApplyInfoMQDto.setComCreditCode(usingData.getComCreditCode());//企业信用代码 + orgApplyInfoMQDto.setComLegalPerson(usingData.getComLegalPerson());//企业法人 + orgApplyInfoMQDto.setOrgAddress(usingData.getOrgAddress());//机构地址 + orgApplyInfoMQDto.setOrgCoordinateLo(usingData.getOrgCoordinateLo());//机构位置坐标:经度 + orgApplyInfoMQDto.setOrgCoordinateLa(usingData.getOrgCoordinateLa());//机构位置坐标:维度 + orgApplyInfoMQDto.setOrgLeader(usingData.getOrgLeader());//机构负责人 + orgApplyInfoMQDto.setOrgLeaderPhone(usingData.getOrgLeaderPhone());//机构负责人电话 + orgApplyInfoMQDto.setOrgBuildingNumber(usingData.getOrgBuildingNumber());//机构楼宇牌号 + orgApplyInfoMQDto.setOrgPropertyType(usingData.getOrgPropertyType());//机构房屋性质 + orgApplyInfoMQDto.setOrgBuildingArea(usingData.getOrgBuildingArea());//机构建筑面积 + orgApplyInfoMQDto.setOrgProvince(usingData.getOrgProvince());//机构省份 + orgApplyInfoMQDto.setOrgCity(usingData.getOrgCity());//机构城市 + orgApplyInfoMQDto.setOrgDistrict(usingData.getOrgDistrict());//机构区域 + //将当前操作人传给运维平台 用于记录工单提交人 + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + orgApplyInfoMQDto.setOperateBy(sysUser.getRealname()); + orgApplyInfoMQDto.setOperateTelephone(sysUser.getPhone()); + orgApplyInfoMQDto.setOperateEmail(sysUser.getEmail()); + orgApplyInfoMQDto.setAuditStatus("审核成功"); + orgApplyInfoMQDto.setContract(usingData.getContract());//加盟合同 + orgApplyInfoMQDto.setContractNote(usingData.getContractNote());//备注信息 + //运维mq收到后 1、自动创建新的机构、机构附加信息 2、生成运维平台工单 + rabbitMQUtil.sendToExchange("hldy.orgApply.build", "hldy.orgApply.build", orgApplyInfoMQDto); + } + + @Override + public IPage queryOrgInfo(IPage page, String orgCode, String title) { + return baseMapper.queryOrgInfo(page, orgCode, title); + } + + @Override + public IPage getOrgByOpenId(IPage page, String openId) { + return baseMapper.getOrgByOpenId(page, null, openId, "2", null, null); + } + + @Override + public void upInfoAudit(OrgApplyInfo orgApplyInfo_) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("pk_id", orgApplyInfo_.getPkId()); + qw.eq("iz_history", "N"); + qw.eq("opt_type", "bg"); + qw.eq("status", "1"); + OrgApplyInfo orgApplyInfo = baseMapper.selectOne(qw); + orgApplyInfo.setAuditTime(new Date()); + orgApplyInfo.setAuditBy(user.getRealname()); + //审核通过 + if ("2".equals(orgApplyInfo_.getStatus())) { + orgApplyInfo.setStatus("2"); + + //修改机构信息 + SysDepartEntity sysDepartEntity = new SysDepartEntity(); + sysDepartEntity.setId(orgApplyInfo.getPkId()); + sysDepartEntity.setDepartName(orgApplyInfo.getComName());//机构名称 + //机构信息 + sysDepartEntity.setTel(orgApplyInfo.getTel());//联系电话 + sysDepartEntity.setWechatName(orgApplyInfo.getWechatName());//微信名称(空字段) + sysDepartEntity.setName(orgApplyInfo.getName());//咨询人姓名 + sysDepartEntity.setSex(orgApplyInfo.getSex());//性别 + sysDepartEntity.setNational(orgApplyInfo.getNational());//民族 + sysDepartEntity.setBirthDate(orgApplyInfo.getBirthDate());//出生日期 + sysDepartEntity.setIdCardAddress(orgApplyInfo.getIdCardAddress());//住址 + sysDepartEntity.setIdCard(orgApplyInfo.getIdCard());//身份证号 + sysDepartEntity.setIssuingAuthority(orgApplyInfo.getIssuingAuthority());//签发机关 + sysDepartEntity.setStartTime(orgApplyInfo.getStartTime());//身份证有效开始日期 + sysDepartEntity.setEndTime(orgApplyInfo.getEndTime());//身份证有效结束日期 + sysDepartEntity.setCardZmPath(orgApplyInfo.getCardZmPath());//身份证照片人像面 + sysDepartEntity.setCardFmPath(orgApplyInfo.getCardFmPath());//身份证照片国徽面 + sysDepartEntity.setComBusinessLicense(orgApplyInfo.getComBusinessLicense());//营业执照照片 + sysDepartEntity.setComName(orgApplyInfo.getComName());//企业名称 + sysDepartEntity.setComRegisterAddress(orgApplyInfo.getComRegisterAddress());//企业注册地址 + sysDepartEntity.setComCreditCode(orgApplyInfo.getComCreditCode());//企业信用代码 + sysDepartEntity.setComLegalPerson(orgApplyInfo.getComLegalPerson());//企业法人 + sysDepartEntity.setOrgAddress(orgApplyInfo.getOrgAddress());//机构地址 + sysDepartEntity.setOrgCoordinateLo(orgApplyInfo.getOrgCoordinateLo());//机构位置坐标:经度 + sysDepartEntity.setOrgCoordinateLa(orgApplyInfo.getOrgCoordinateLa());//机构位置坐标:维度 + sysDepartEntity.setOrgLeader(orgApplyInfo.getOrgLeader());//机构负责人 + sysDepartEntity.setOrgLeaderPhone(orgApplyInfo.getOrgLeaderPhone());//机构负责人电话 + sysDepartEntity.setOrgBuildingNumber(orgApplyInfo.getOrgBuildingNumber());//机构楼宇牌号 + sysDepartEntity.setOrgPropertyType(orgApplyInfo.getOrgPropertyType());//机构房屋性质 + sysDepartEntity.setOrgBuildingArea(orgApplyInfo.getOrgBuildingArea());//机构建筑面积 + sysDepartEntity.setOrgProvince(orgApplyInfo.getOrgProvince());//机构省份 + sysDepartEntity.setOrgCity(orgApplyInfo.getOrgCity());//机构城市 + sysDepartEntity.setOrgDistrict(orgApplyInfo.getOrgDistrict());//机构区域 + sysBaseAPI.updateById(sysDepartEntity); + //发送小程序、微信通知 NuWxNoticeEntity nuWxNotice = new NuWxNoticeEntity(); nuWxNotice.setOpenId(orgApplyInfo.getOpenId()); @@ -230,18 +561,11 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl qw = new QueryWrapper<>(); - qw = new QueryWrapper<>(); - qw.eq("pk_id", orgApplyInfo.getPkId()); - OrgApplyInfo upData_ = new OrgApplyInfo(); - upData_.setModifyStatus("0"); - baseMapper.update(upData_, qw); - - //将变更后数据设置为被驳回状态 - orgApplyInfo.setStatus("5"); - baseMapper.updateById(orgApplyInfo); + } + //审核驳回 + if (StringUtils.equals("3", orgApplyInfo_.getStatus())) { + orgApplyInfo.setStatus("3"); + orgApplyInfo.setContent(orgApplyInfo_.getContent()); //发送小程序、微信通知 NuWxNoticeEntity nuWxNotice = new NuWxNoticeEntity(); @@ -259,109 +583,16 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl updateWrapper = new UpdateWrapper<>(); - updateWrapper.set("content", null); - updateWrapper.eq("id", orgApplyInfo.getId()); - update(updateWrapper); - } } - - } - - - @Override - public void submitContract(OrgApplyInfo orgApplyInfo) { - //先保存数据 将构建状态置为“平台搭建” - orgApplyInfo.setBuildStatus("4"); + //修改数据 baseMapper.updateById(orgApplyInfo); - //给运维平台推送mq 增加机构加盟后的平台搭建任务 - OrgApplyInfoMQDto orgApplyInfoMQDto = new OrgApplyInfoMQDto(); - BeanUtils.copyProperties(orgApplyInfo, orgApplyInfoMQDto); - //将当前操作人传给运维平台 用于记录工单提交人 - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - orgApplyInfoMQDto.setOperateBy(sysUser.getRealname()); - orgApplyInfoMQDto.setOperateTelephone(sysUser.getPhone()); - orgApplyInfoMQDto.setOperateEmail(sysUser.getEmail()); - orgApplyInfoMQDto.setAuditStatus("审核成功"); -// orgApplyInfoMQDto.setAuditBy(sysUser.getRealname()); -// orgApplyInfoMQDto.setAuditTime(orgApplyInfo.getAuditTime()); - //运维mq收到后 1、自动创建新的机构、机构附加信息 2、生成运维平台工单 - rabbitMQUtil.sendToExchange("hldy.orgApply.build", "hldy.orgApply.build", orgApplyInfoMQDto); + + //TODO 通知运维平台去修改 } @Override - public IPage queryOrgInfo(IPage page, String orgCode, String title) { - return baseMapper.queryOrgInfo(page, orgCode, title); - } - - @Override - public IPage getOrgByOpenId(IPage page, String openId) { - return baseMapper.getOrgByOpenId(page, null, openId, "2", null, null); + public IPage pageList(OrgApplyInfo orgApplyInfo, Page page) { + return baseMapper.pageList(orgApplyInfo, page); } @Override @@ -393,63 +624,137 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl beforeQW = new QueryWrapper<>(); + beforeQW.eq("pk_id", newData.getPkId()); + beforeQW.eq("iz_history", "N"); + beforeQW.orderByDesc("create_time"); + List list = baseMapper.selectList(beforeQW); + if (CollectionUtils.isEmpty(list)) { + return true; + } + OrgApplyInfo beforeData = list.get(0); + + + // 显式对比需要校验变更的字段(排除你列出的字段) + return !( + Objects.equals(newData.getTel(), beforeData.getTel()) && + Objects.equals(newData.getName(), beforeData.getName()) && + Objects.equals(newData.getSex(), beforeData.getSex()) && + Objects.equals(newData.getNational(), beforeData.getNational()) && + Objects.equals(newData.getBirthDate(), beforeData.getBirthDate()) && + Objects.equals(newData.getIdCardAddress(), beforeData.getIdCardAddress()) && + Objects.equals(newData.getIdCard(), beforeData.getIdCard()) && + Objects.equals(newData.getIssuingAuthority(), beforeData.getIssuingAuthority()) && + Objects.equals(newData.getStartTime(), beforeData.getStartTime()) && + Objects.equals(newData.getEndTime(), beforeData.getEndTime()) && + Objects.equals(newData.getCardZmPath(), beforeData.getCardZmPath()) && + Objects.equals(newData.getCardFmPath(), beforeData.getCardFmPath()) && + Objects.equals(newData.getComBusinessLicense(), beforeData.getComBusinessLicense()) && + Objects.equals(newData.getComName(), beforeData.getComName()) && + Objects.equals(newData.getComRegisterAddress(), beforeData.getComRegisterAddress()) && + Objects.equals(newData.getComCreditCode(), beforeData.getComCreditCode()) && + Objects.equals(newData.getComLegalPerson(), beforeData.getComLegalPerson()) && + Objects.equals(newData.getOrgAddress(), beforeData.getOrgAddress()) && + Objects.equals(newData.getOrgCoordinateLo(), beforeData.getOrgCoordinateLo()) && + Objects.equals(newData.getOrgCoordinateLa(), beforeData.getOrgCoordinateLa()) && + Objects.equals(newData.getOrgLeader(), beforeData.getOrgLeader()) && + Objects.equals(newData.getOrgLeaderPhone(), beforeData.getOrgLeaderPhone()) && + Objects.equals(newData.getOrgBuildingNumber(), beforeData.getOrgBuildingNumber()) && + Objects.equals(newData.getOrgPropertyType(), beforeData.getOrgPropertyType()) && + Objects.equals(newData.getOrgBuildingArea(), beforeData.getOrgBuildingArea()) && + Objects.equals(newData.getOrgProvince(), beforeData.getOrgProvince()) && + Objects.equals(newData.getOrgCity(), beforeData.getOrgCity()) && + Objects.equals(newData.getOrgDistrict(), beforeData.getOrgDistrict()) + ); + } + /** * 验证是否有变化 + * 跟正在使用的机构信息去比对 + * + * @param newData + * @return + */ + @Override + public boolean validateUpInfoChanged(OrgAllInfoApiEntity newData) { + SysDepartEntity usingData = sysBaseAPI.selectDepartById(newData.getPkId()); + + // 显式对比需要校验变更的字段(排除你列出的字段) + return !( + Objects.equals(newData.getTel(), usingData.getTel()) && + Objects.equals(newData.getName(), usingData.getName()) && + Objects.equals(newData.getSex(), usingData.getSex()) && + Objects.equals(newData.getNational(), usingData.getNational()) && + Objects.equals(newData.getBirthDate(), usingData.getBirthDate()) && + Objects.equals(newData.getIdCardAddress(), usingData.getIdCardAddress()) && + Objects.equals(newData.getIdCard(), usingData.getIdCard()) && + Objects.equals(newData.getIssuingAuthority(), usingData.getIssuingAuthority()) && + Objects.equals(newData.getStartTime(), usingData.getStartTime()) && + Objects.equals(newData.getEndTime(), usingData.getEndTime()) && + Objects.equals(newData.getCardZmPath(), usingData.getCardZmPath()) && + Objects.equals(newData.getCardFmPath(), usingData.getCardFmPath()) && + Objects.equals(newData.getComBusinessLicense(), usingData.getComBusinessLicense()) && + Objects.equals(newData.getComName(), usingData.getComName()) && + Objects.equals(newData.getComRegisterAddress(), usingData.getComRegisterAddress()) && + Objects.equals(newData.getComCreditCode(), usingData.getComCreditCode()) && + Objects.equals(newData.getComLegalPerson(), usingData.getComLegalPerson()) && + Objects.equals(newData.getOrgAddress(), usingData.getOrgAddress()) && + Objects.equals(newData.getOrgCoordinateLo(), usingData.getOrgCoordinateLo()) && + Objects.equals(newData.getOrgCoordinateLa(), usingData.getOrgCoordinateLa()) && + Objects.equals(newData.getOrgLeader(), usingData.getOrgLeader()) && + Objects.equals(newData.getOrgLeaderPhone(), usingData.getOrgLeaderPhone()) && + Objects.equals(newData.getOrgBuildingNumber(), usingData.getOrgBuildingNumber()) && + Objects.equals(newData.getOrgPropertyType(), usingData.getOrgPropertyType()) && + Objects.equals(newData.getOrgBuildingArea(), usingData.getOrgBuildingArea()) && + Objects.equals(newData.getOrgProvince(), usingData.getOrgProvince()) && + Objects.equals(newData.getOrgCity(), usingData.getOrgCity()) && + Objects.equals(newData.getOrgDistrict(), usingData.getOrgDistrict()) + ); + } + + /** + * 验证企业名称是否已被占用 * * @param orgApplyInfoApiEntity * @return */ @Override - public boolean validateChanged(OrgApplyInfoApiEntity orgApplyInfoApiEntity) { - QueryWrapper qw = new QueryWrapper<>(); - qw.eq("pk_id", orgApplyInfoApiEntity.getPkId()); - if ("1".equals(orgApplyInfoApiEntity.getStatus())) { - qw.eq("status", "3"); - } else if ("4".equals(orgApplyInfoApiEntity.getStatus())) { - qw.eq("status", "2"); + public boolean validateComNamerepet(OrgAllInfoApiEntity orgApplyInfoApiEntity) { + //检测sys_depart是否有重复名称 + int sysDepartRepetCount = baseMapper.validateSysDepartComNamerepet(orgApplyInfoApiEntity); + if (sysDepartRepetCount > 0) { + return true; + } + //检测申请表 + int applyOrgRepetCount = baseMapper.validateApplyOrgComNamerepet(orgApplyInfoApiEntity); + if (applyOrgRepetCount > 0) { + return true; + } + return false; + } + + @Override + public OrgAllInfoApiEntity queryOrgInfoById(String id) { + OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); + orgApplyInfo.setId(id); + List orgAllInfoApiEntities = baseMapper.orgList(orgApplyInfo); + if (CollectionUtils.isEmpty(orgAllInfoApiEntities)) { + return null; } else { - qw.eq("status", "-1314"); + OrgAllInfoApiEntity par = orgAllInfoApiEntities.get(0); + par.setOrgProvince_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgProvince())); + par.setOrgCity_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgCity())); + par.setOrgDistrict_dictText(dictUtils.translateDictValue("id", "name", "sys_category", par.getOrgDistrict())); + return orgAllInfoApiEntities.get(0); } - OrgApplyInfo dbRecord = baseMapper.selectOne(qw); - if ("1".equals(orgApplyInfoApiEntity.getStatus())) { - if (dbRecord == null) { - return true; - } - } - - OrgApplyInfo inputRecord = new OrgApplyInfo(); - BeanUtils.copyProperties(orgApplyInfoApiEntity, inputRecord); - - // 显式对比需要校验变更的字段(排除你列出的字段) - return !( - Objects.equals(dbRecord.getTel(), inputRecord.getTel()) && - Objects.equals(dbRecord.getName(), inputRecord.getName()) && - Objects.equals(dbRecord.getSex(), inputRecord.getSex()) && - Objects.equals(dbRecord.getNational(), inputRecord.getNational()) && - Objects.equals(dbRecord.getBirthDate(), inputRecord.getBirthDate()) && - Objects.equals(dbRecord.getIdCardAddress(), inputRecord.getIdCardAddress()) && - Objects.equals(dbRecord.getIdCard(), inputRecord.getIdCard()) && - Objects.equals(dbRecord.getIssuingAuthority(), inputRecord.getIssuingAuthority()) && - Objects.equals(dbRecord.getStartTime(), inputRecord.getStartTime()) && - Objects.equals(dbRecord.getEndTime(), inputRecord.getEndTime()) && - Objects.equals(dbRecord.getCardZmPath(), inputRecord.getCardZmPath()) && - Objects.equals(dbRecord.getCardFmPath(), inputRecord.getCardFmPath()) && - Objects.equals(dbRecord.getComBusinessLicense(), inputRecord.getComBusinessLicense()) && - Objects.equals(dbRecord.getComName(), inputRecord.getComName()) && - Objects.equals(dbRecord.getComRegisterAddress(), inputRecord.getComRegisterAddress()) && - Objects.equals(dbRecord.getComCreditCode(), inputRecord.getComCreditCode()) && - Objects.equals(dbRecord.getComLegalPerson(), inputRecord.getComLegalPerson()) && - Objects.equals(dbRecord.getOrgAddress(), inputRecord.getOrgAddress()) && - Objects.equals(dbRecord.getOrgCoordinateLo(), inputRecord.getOrgCoordinateLo()) && - Objects.equals(dbRecord.getOrgCoordinateLa(), inputRecord.getOrgCoordinateLa()) && - Objects.equals(dbRecord.getOrgLeader(), inputRecord.getOrgLeader()) && - Objects.equals(dbRecord.getOrgLeaderPhone(), inputRecord.getOrgLeaderPhone()) && - Objects.equals(dbRecord.getOrgBuildingNumber(), inputRecord.getOrgBuildingNumber()) && - Objects.equals(dbRecord.getOrgPropertyType(), inputRecord.getOrgPropertyType()) && - Objects.equals(dbRecord.getOrgBuildingArea(), inputRecord.getOrgBuildingArea()) && - Objects.equals(dbRecord.getOrgProvince(), inputRecord.getOrgProvince()) && - Objects.equals(dbRecord.getOrgCity(), inputRecord.getOrgCity()) && - Objects.equals(dbRecord.getOrgDistrict(), inputRecord.getOrgDistrict()) - ); } } diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/weixin/controller/WechatMiniController.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/weixin/controller/WechatMiniController.java index f3f6aef..bb9cf56 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/weixin/controller/WechatMiniController.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/modules/weixin/controller/WechatMiniController.java @@ -69,7 +69,8 @@ public class WechatMiniController { if (success) { OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); orgApplyInfo.setId(id); - orgApplyInfo.setBuildStatus("6"); + //todo 下面一行临时注掉 +// orgApplyInfo.setBuildStatus("6"); orgApplyInfoService.updateById(orgApplyInfo); System.out.println("模板消息发送成功"); diff --git a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/workorder/listener/WorkOrderMQListener.java b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/workorder/listener/WorkOrderMQListener.java index aa06ec7..c67e8b1 100644 --- a/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/workorder/listener/WorkOrderMQListener.java +++ b/nursing-unit-admin/nu-admin-biz/src/main/java/com/nu/mq/workorder/listener/WorkOrderMQListener.java @@ -27,7 +27,7 @@ public class WorkOrderMQListener { /** * 工单回执 */ - @AutoLog(value = "工单-工单回执") +// @AutoLog(value = "工单-工单回执") 这个注解依赖上下文request对象 mq没这个对象 必须加的话就写个表插入 @RabbitListener( bindings = @QueueBinding( value = @Queue(name = "nu.workOrder.reply"), @@ -40,32 +40,17 @@ public class WorkOrderMQListener { log.info("接收到工单回复"); log.info("工单回复: {}", workOrderMQDto); - OrgApplyInfo orgApplyInfo = orgApplyInfoService.getById(workOrderMQDto.getOrgId()); - if(orgApplyInfo != null){ - orgApplyInfo.setReplyContent(workOrderMQDto.getReplyContent()); - orgApplyInfo.setReplyFile(workOrderMQDto.getReplyFile()); - orgApplyInfo.setReplyTime(workOrderMQDto.getReplyTime()); - orgApplyInfo.setHandleBy(workOrderMQDto.getHandleBy()); - orgApplyInfo.setWorkOrderStatus("2"); - orgApplyInfo.setWorkOrderId(workOrderMQDto.getId()); - orgApplyInfoService.updateById(orgApplyInfo); - } - - //新增机构信息(如果没有) - SysDepartModel sysDepartModel = sysBaseAPI.selectDepartById(workOrderMQDto.getOrgId()); - if(sysDepartModel.getId() == null){ - SysDepartEntity sysDepart =new SysDepartEntity(); - sysDepart.setId(workOrderMQDto.getOrgId()); - sysDepart.setCreateBy("admin"); - sysDepart.setDepartName(workOrderMQDto.getOrgName()); - sysDepart.setDepartOrder(0); - sysDepart.setOrgCategory("1"); - sysDepart.setOrgType("1"); - sysDepart.setDelFlag("0"); - sysDepart.setIzLeaf(1); - sysDepart.setPlatType("ywjg"); - sysDepart.setOrgCode(workOrderMQDto.getOrgCode()); - sysBaseAPI.addOrg(sysDepart); + SysDepartEntity data = sysBaseAPI.selectDepartById(workOrderMQDto.getOrgId()); + if (data != null) { + data.setReplyContent(workOrderMQDto.getReplyContent()); + data.setReplyFile(workOrderMQDto.getReplyFile()); + data.setReplyTime(workOrderMQDto.getReplyTime()); + data.setHandleBy(workOrderMQDto.getHandleBy()); + data.setWorkOrderStatus("2"); + data.setWorkOrderId(workOrderMQDto.getId()); + data.setOrgCode(workOrderMQDto.getOrgCode()); + data.setStatus("1"); + sysBaseAPI.updateById(data); } } diff --git a/nursing-unit-api/src/main/java/com/nu/modules/wechat/elder/api/ElderApi.java b/nursing-unit-api/src/main/java/com/nu/modules/wechat/elder/api/ElderApi.java index f09e3ca..49cf050 100644 --- a/nursing-unit-api/src/main/java/com/nu/modules/wechat/elder/api/ElderApi.java +++ b/nursing-unit-api/src/main/java/com/nu/modules/wechat/elder/api/ElderApi.java @@ -290,7 +290,7 @@ public class ElderApi { @PostMapping("/addElder") public Result save(@RequestParam("ukey") String ukey, @RequestBody ElderInfoEntity elderInfoEntity) { if (NuRedisUtils.existKey(ukey)) { - return Result.ok("重复提交"); + return Result.ok("提交过于频繁,请稍后重试"); } //长者id String id = elderInfoEntity.getSysOrgCode() + IdUtil.simpleUUID(); @@ -367,7 +367,7 @@ public class ElderApi { } } if (NuRedisUtils.existKey(ukey)) { - return Result.ok("重复提交"); + return Result.ok("提交过于频繁,请稍后重试"); } elderInfoEntity.setOrgCode(elderInfoEntity.getOrgCode()); ElderInfoMQDto mqdto = new ElderInfoMQDto(); diff --git a/nursing-unit-api/src/main/java/com/nu/modules/wechat/orgapplyinfo/api/OrgApplyInfoApi.java b/nursing-unit-api/src/main/java/com/nu/modules/wechat/orgapplyinfo/api/OrgApplyInfoApi.java index a85fa7f..4018dc9 100644 --- a/nursing-unit-api/src/main/java/com/nu/modules/wechat/orgapplyinfo/api/OrgApplyInfoApi.java +++ b/nursing-unit-api/src/main/java/com/nu/modules/wechat/orgapplyinfo/api/OrgApplyInfoApi.java @@ -1,11 +1,13 @@ package com.nu.modules.wechat.orgapplyinfo.api; import com.nu.modules.orgapplyinfo.api.IOrgApplyInfoApi; -import com.nu.modules.orgapplyinfo.entity.OrgApplyInfoApiEntity; +import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; +import com.nu.modules.orgapplyinfo.entity.OrgAllInfoApiEntity; import com.nu.utils.NuRedisUtils; import org.apache.commons.lang.StringUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -21,44 +23,78 @@ public class OrgApplyInfoApi { /** * 新增/编辑机构加盟申请信息 * - * @param orgApplyInfoApiEntity + * @param dto * @return */ @AutoLog(value = "新增/编辑机构加盟申请信息") @PostMapping("/save") - public Result save(@RequestParam("ukey") String ukey, @RequestBody OrgApplyInfoApiEntity orgApplyInfoApiEntity) { - //变更信息时 验证是否有变化 没有变化不允许提交 - if ("1".equals(orgApplyInfoApiEntity.getStatus()) || "4".equals(orgApplyInfoApiEntity.getStatus())) { - if (!orgApplyInfoApi.validateChanged(orgApplyInfoApiEntity)) { - return Result.ok("未做变更"); + public Result save(@RequestParam("ukey") String ukey, @RequestBody OrgAllInfoApiEntity dto) { + OrgAllInfoApiEntity orgApplyInfoApiEntity = new OrgAllInfoApiEntity(); + BeanUtils.copyProperties(dto, orgApplyInfoApiEntity); + if (NuRedisUtils.existKey(ukey)) { + return Result.error("提交过于频繁,请稍后重试"); + } + + //验证入驻申请信息是否有变更 + if ("1".equals(orgApplyInfoApiEntity.getStatus()) && StringUtils.isNotBlank(orgApplyInfoApiEntity.getPkId())) { + if (!orgApplyInfoApi.validateApplyChanged(orgApplyInfoApiEntity)) { + return Result.error("未做变更"); } } - if (NuRedisUtils.existKey(ukey)) { - return Result.ok("重复提交"); + //验证机构变更信息是否有变更 + if ("4".equals(orgApplyInfoApiEntity.getStatus())) { + if (!orgApplyInfoApi.validateUpInfoChanged(orgApplyInfoApiEntity)) { + return Result.error("未做变更"); + } } + //验证企业名称是否正在被使用 或者被别人审核中(排除自己) + if (orgApplyInfoApi.validateComNamerepet(orgApplyInfoApiEntity)) { + return Result.error("企业名称已占用"); + } + System.out.println("-----------新增/编辑机构加盟申请信息--------tel------------" + orgApplyInfoApiEntity.getTel()); - if (StringUtils.isNotBlank(orgApplyInfoApiEntity.getId())) { + if (StringUtils.isNotBlank(orgApplyInfoApiEntity.getId()) && !"rz".equals(orgApplyInfoApiEntity.getOptType())) { orgApplyInfoApi.updateById(orgApplyInfoApiEntity); return Result.ok("保存成功!"); } else { - return Result.ok(orgApplyInfoApi.insert(orgApplyInfoApiEntity)); + //入驻申请 + if ("1".equals(orgApplyInfoApiEntity.getStatus())) { + return Result.ok(orgApplyInfoApi.insertApply(orgApplyInfoApiEntity)); + } else { + //变更申请 + return Result.ok(orgApplyInfoApi.insertUpInfo(orgApplyInfoApiEntity)); + } } } /** - * 根据微信号获取加盟申请信息 + * 小程序-机构端-主页列表查询 + * 查询已经入住机构+申请中/被驳回机构 * - * @param id nu_org_apply_info表id * @param openId 微信openid - * @param status 审核状态 + * @return 返回内容是两个表拼接的数据 status1和3就是审核中和被驳回 2时需要看orgStatus(3代表刚加盟通过 还没搭建-等待管理平台上传合同 4是技术人员搭建平台中(看work_order_status 1是等待搭建 2是搭建完了 但是没账号没办法登录) 5是可以登录了) + */ + @GetMapping("/queryOrgHomePageList") + public Result> queryOrgHomePageList(@RequestParam("openId") String openId) { + return Result.ok(orgApplyInfoApi.queryOrgHomePageList(openId)); + } + + @GetMapping("/queryOrgInfoById") + public Result queryOrgInfoById(@RequestParam("id") String id) { + return Result.ok(orgApplyInfoApi.queryOrgInfoById(id)); + } + + /** + * 小程序-机构端-我的-机构信息 + * 查询加盟/变更历史 + * + * @param openId 微信openid + * @param optType 入驻rz 变更bg * @return */ - @GetMapping("/queryAuditInfo") - public Result> queryAuditInfo(@RequestParam("openId") String openId, @RequestParam(value = "id", required = false) String id, @RequestParam(value = "status", required = false) String status) { - if (StringUtils.isBlank(openId)) { - return Result.error("未填写openId"); - } - return Result.ok(orgApplyInfoApi.queryAuditInfo(openId, id, status)); + @GetMapping("/queryOrgHis") + public Result> queryOrgHis(@RequestParam("openId") String openId, @RequestParam("optType") String optType) { + return Result.ok(orgApplyInfoApi.queryOrgHis(openId, optType)); } } diff --git a/nursing-unit-common/src/main/java/com/nu/dto/OrgApplyInfoMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/OrgApplyInfoMQDto.java index bce1261..259f71c 100644 --- a/nursing-unit-common/src/main/java/com/nu/dto/OrgApplyInfoMQDto.java +++ b/nursing-unit-common/src/main/java/com/nu/dto/OrgApplyInfoMQDto.java @@ -1,6 +1,8 @@ package com.nu.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; @@ -43,9 +45,9 @@ public class OrgApplyInfoMQDto implements Serializable { */ private String modifyStatus; /** - * 构建状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】 + * 机构状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】 */ - private String buildStatus; + private String orgStatus; //构建状态前后台处理逻辑字段 private String buildStatusVal; @@ -89,6 +91,8 @@ public class OrgApplyInfoMQDto implements Serializable { /** * 出生日期 */ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy年MM月dd日") + @DateTimeFormat(pattern="yyyy年MM月dd日") private java.util.Date birthDate; /** * 住址(身份证上) diff --git a/nursing-unit-common/src/main/java/com/nu/dto/WorkOrderMQDto.java b/nursing-unit-common/src/main/java/com/nu/dto/WorkOrderMQDto.java index c6db6e2..12e0493 100644 --- a/nursing-unit-common/src/main/java/com/nu/dto/WorkOrderMQDto.java +++ b/nursing-unit-common/src/main/java/com/nu/dto/WorkOrderMQDto.java @@ -1,17 +1,6 @@ package com.nu.dto; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.jeecg.common.aspect.annotation.Dict; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; @@ -19,48 +8,48 @@ import java.util.Date; /** * @Description: 工单表 * @Author: zmy - * @Date: 2025-07-08 + * @Date: 2025-07-09 * @Version: V1.0 */ @Data public class WorkOrderMQDto implements Serializable { private static final long serialVersionUID = 1L; - /**id*/ + /**id*/ private String id; - /**区分同一工单用nu_word_order.id*/ + /**区分同一工单用nu_word_order.id*/ private String pkId; - /**机构ID*/ + /**机构ID*/ private String orgId; - /**机构编码(可能不存在)*/ + /**机构编码(可能不存在)*/ private String orgCode; - /**机构名称*/ + /**机构名称*/ private String orgName; - /**平台类型pc wechat pad*/ + /**平台类型pc wechat pad*/ private String platType; - /**标题*/ + /**标题*/ private String title; - /**描述*/ + /**描述*/ private String content; - /**附件*/ + /**附件*/ private String filePath; - /**状态 0待接收 1处理中 3已解决 4工单异常 5外部原因*/ + /**状态 0待接收 1处理中 3已解决 4工单异常 5外部原因*/ private String status; - /**创建人*/ + /**创建人*/ private String createBy; - /**创建时间*/ + /**创建时间*/ private Date createTime; - /**回复内容*/ + /**回复内容*/ private String replyContent; - /**回复附件*/ + /**回复附件*/ private String replyFile; - /**回复时间*/ + /**回复时间*/ private Date replyTime; - /**处理人*/ + /**处理人*/ private String handleBy; - /**工单提交人联系电话*/ + /**工单提交人联系电话*/ private String tel; - /**工单提交人邮件地址*/ + /**工单提交人邮件地址*/ private String email; /**状态 1平台构建*/ private String workType; diff --git a/nursing-unit-common/src/main/java/com/nu/utils/NuRedisUtils.java b/nursing-unit-common/src/main/java/com/nu/utils/NuRedisUtils.java index 2587542..46c7288 100644 --- a/nursing-unit-common/src/main/java/com/nu/utils/NuRedisUtils.java +++ b/nursing-unit-common/src/main/java/com/nu/utils/NuRedisUtils.java @@ -27,7 +27,7 @@ public class NuRedisUtils implements ApplicationContextAware { } if (!redisUtil.hasKey(key)) { - redisUtil.set(key, key, 15); // 过期时间 + redisUtil.set(key, key, 5); // 过期时间 return false; } else { return true; diff --git a/nursing-unit-system/nu-system-api/nu-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java b/nursing-unit-system/nu-system-api/nu-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java index eca4504..1c525e1 100644 --- a/nursing-unit-system/nu-system-api/nu-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java +++ b/nursing-unit-system/nu-system-api/nu-system-local-api/src/main/java/org/jeecg/common/system/api/ISysBaseAPI.java @@ -641,5 +641,9 @@ public interface ISysBaseAPI extends CommonAPI { * @param id 部门id * @return SysDepartModel对象 */ - SysDepartModel selectDepartById(String id); + SysDepartEntity selectDepartById(String id); + + List queryAllAuditPassOrg(SysDepartEntity queryParams); + + void updateById(SysDepartEntity sysDepartEntity); } diff --git a/nursing-unit-system/nu-system-api/nu-system-local-api/src/main/java/org/jeecg/common/system/entity/SysDepartEntity.java b/nursing-unit-system/nu-system-api/nu-system-local-api/src/main/java/org/jeecg/common/system/entity/SysDepartEntity.java index 4013077..578c7c3 100644 --- a/nursing-unit-system/nu-system-api/nu-system-local-api/src/main/java/org/jeecg/common/system/entity/SysDepartEntity.java +++ b/nursing-unit-system/nu-system-api/nu-system-local-api/src/main/java/org/jeecg/common/system/entity/SysDepartEntity.java @@ -1,9 +1,15 @@ package org.jeecg.common.system.entity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.Date; /** @@ -179,6 +185,107 @@ public class SysDepartEntity implements Serializable { */ private String picUrl; + /**加盟时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private java.util.Date franchiseTime; + /**机构状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】*/ + @Dict(dicCode = "org_build_status") + private java.lang.String orgStatus; + /**合同提交时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private java.util.Date htCommitTime; + /**合同提交人*/ + private java.lang.String htCommitBy; + /**合同附件*/ + private java.lang.String contract; + /**合同备注*/ + private java.lang.String contractNote; + + /**工单状态 0未提交 1待执行 2已回执*/ + @Dict(dicCode = "work_order_status") + private java.lang.String workOrderStatus; + /**工单ID*/ + private java.lang.String workOrderId; + /**回复内容*/ + private java.lang.String replyContent; + /**回复附件*/ + private java.lang.String replyFile; + /**回复时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private java.util.Date replyTime; + /**回复人*/ + private java.lang.String handleBy; + + /**微信id*/ + private java.lang.String openId; + /**微信名称*/ + private java.lang.String wechatName; + /**联系电话*/ + private java.lang.String tel; + /**咨询人姓名*/ + private java.lang.String name; + /**性别*/ + private java.lang.String sex; + /**民族*/ + private java.lang.String national; + /**出生日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy年MM月dd日") + @DateTimeFormat(pattern="yyyy年MM月dd日") + private Date birthDate; + /**住址(身份证上)*/ + private java.lang.String idCardAddress; + /**身份证号*/ + private java.lang.String idCard; + /**签发机关*/ + private java.lang.String issuingAuthority; + /**有效开始日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + private java.util.Date startTime; + /**有效结束日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + private java.util.Date endTime; + /**身份证正面*/ + private java.lang.String cardZmPath; + /**身份证反面*/ + private java.lang.String cardFmPath; + /**营业执照照片*/ + private java.lang.String comBusinessLicense; + /**企业名称*/ + private java.lang.String comName; + /**企业注册地址*/ + private java.lang.String comRegisterAddress; + /**企业信用代码*/ + private java.lang.String comCreditCode; + /**企业法人*/ + private java.lang.String comLegalPerson; + /**机构地址*/ + private java.lang.String orgAddress; + /**机构位置坐标:经度*/ + private String orgCoordinateLo; + /**机构位置坐标:纬度*/ + private String orgCoordinateLa; + /**机构负责人*/ + private java.lang.String orgLeader; + /**机构负责人电话*/ + private java.lang.String orgLeaderPhone; + /**机构楼宇牌号*/ + private java.lang.String orgBuildingNumber; + /**机构房屋性质*/ + private java.lang.String orgPropertyType; + /**机构建筑面积*/ + private java.lang.Double orgBuildingArea; + /**机构省份 sys_category.id*/ + private java.lang.String orgProvince; + /**机构城市 sys_category.id*/ + private java.lang.String orgCity; + /**机构区域 sys_category.id*/ + private java.lang.String orgDistrict; + //update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段负责人ids和旧的负责人ids /** * 部门负责人的ids diff --git a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java index 29267be..3880d6e 100644 --- a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java +++ b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/controller/SysUserController.java @@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.nu.modules.orgapplyinfo.entity.OrgApplyInfo; import com.nu.modules.orgapplyinfo.service.IOrgApplyInfoService; +import org.jeecg.common.system.api.ISysBaseAPI; +import org.jeecg.common.system.entity.SysDepartEntity; import org.jeecg.modules.system.entity.*; import org.jeecg.modules.system.model.DepartIdModel; import org.jeecg.modules.system.model.SysUserSysDepartModel; @@ -109,6 +111,9 @@ public class SysUserController { @Autowired private IOrgApplyInfoService orgApplyInfoService; + @Autowired + private ISysBaseAPI sysBaseAPI; + /** * 获取租户下用户数据(支持租户隔离) * @param user @@ -1920,7 +1925,7 @@ public class SysUserController { try { SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); - SysDepart depart = sysDepartService.getDepartById(user.getOrgCode()); + SysDepart depart = sysDepartService.getDepartById(jsonObject.getString("orgId")); if(depart == null){ return Result.error("未找到机构信息"); } @@ -1947,10 +1952,10 @@ public class SysUserController { baseCommonService.addLog("添加用户,username: " +user.getUsername() ,CommonConstant.LOG_TYPE_2, 2); //修改机构加盟申请信息 - OrgApplyInfo orgApplyInfo = new OrgApplyInfo(); - orgApplyInfo.setId(depart.getId()); - orgApplyInfo.setBuildStatus("5"); - orgApplyInfoService.updateById(orgApplyInfo); + SysDepartEntity sysDepartEntity = new SysDepartEntity(); + sysDepartEntity.setId(depart.getId()); + sysDepartEntity.setOrgStatus("5"); + sysBaseAPI.updateById(sysDepartEntity); result.put("message","初始化成功!账号:" + jsonObject.getString("userName") + " 密码:123456"); } catch (Exception e) { diff --git a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java index 0169f0c..8c00061 100644 --- a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java +++ b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.jeecg.common.aspect.annotation.Dict; import org.jeecgframework.poi.excel.annotation.Excel; @@ -12,6 +13,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.Date; import java.util.Objects; @@ -230,6 +232,264 @@ public class SysDepart implements Serializable { */ private String picUrl; + /** + * 加盟时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "加盟时间") + private java.util.Date franchiseTime; + /** + * 机构状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】 + */ + @Dict(dicCode = "org_build_status") + @Excel(name = "机构状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】", width = 15) + @ApiModelProperty(value = "机构状态构建状态1、机构加盟【小程序】2、加盟审核【管理平台】3、加盟合同【管理平台】4、平台搭建【运维平台】5、账户初始化【管理平台】6、信息推送【公众号】") + private java.lang.String orgStatus; + /** + * 合同提交时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "合同提交时间") + private java.util.Date htCommitTime; + /** + * 合同提交人 + */ + @Excel(name = "合同提交人", width = 15) + @ApiModelProperty(value = "合同提交人") + private java.lang.String htCommitBy; + /** + * 合同附件 + */ + @Excel(name = "合同附件", width = 15) + @ApiModelProperty(value = "合同附件") + private java.lang.String contract; + /** + * 合同备注 + */ + @Excel(name = "合同备注", width = 15) + @ApiModelProperty(value = "合同备注") + private java.lang.String contractNote; + + /** + * 工单状态 0未提交 1待执行 2已回执 + */ + @Dict(dicCode = "work_order_status") + private java.lang.String workOrderStatus; + /** + * 工单ID + */ + private java.lang.String workOrderId; + /** + * 回复内容 + */ + private java.lang.String replyContent; + /** + * 回复附件 + */ + private java.lang.String replyFile; + /** + * 回复时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private java.util.Date replyTime; + /** + * 回复人 + */ + private java.lang.String handleBy; + + /** + * 微信id + */ + @Excel(name = "微信id", width = 15) + @ApiModelProperty(value = "微信id") + private java.lang.String openId; + /** + * 微信名称 + */ + @Excel(name = "微信名称", width = 15) + @ApiModelProperty(value = "微信名称") + private java.lang.String wechatName; + /** + * 联系电话 + */ + @Excel(name = "联系电话", width = 15) + @ApiModelProperty(value = "联系电话") + private java.lang.String tel; + /** + * 咨询人姓名 + */ + @Excel(name = "咨询人姓名", width = 15) + @ApiModelProperty(value = "咨询人姓名") + private java.lang.String name; + /** + * 性别 + */ + @Excel(name = "性别", width = 15) + @ApiModelProperty(value = "性别") + private java.lang.String sex; + /** + * 民族 + */ + @Excel(name = "民族", width = 15) + @ApiModelProperty(value = "民族") + private java.lang.String national; + /** + * 出生日期 + */ + @Excel(name = "出生日期", width = 20, format = "yyyy年MM月dd日") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy年MM月dd日") + @DateTimeFormat(pattern="yyyy年MM月dd日") + @ApiModelProperty(value = "出生日期") + private Date birthDate; + /** + * 住址(身份证上) + */ + @Excel(name = "住址(身份证上)", width = 15) + @ApiModelProperty(value = "住址(身份证上)") + private java.lang.String idCardAddress; + /** + * 身份证号 + */ + @Excel(name = "身份证号", width = 15) + @ApiModelProperty(value = "身份证号") + private java.lang.String idCard; + /** + * 签发机关 + */ + @Excel(name = "签发机关", width = 15) + @ApiModelProperty(value = "签发机关") + private java.lang.String issuingAuthority; + /** + * 有效开始日期 + */ + @Excel(name = "有效开始日期", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "有效开始日期") + private java.util.Date startTime; + /** + * 有效结束日期 + */ + @Excel(name = "有效结束日期", width = 20, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "有效结束日期") + private java.util.Date endTime; + /** + * 身份证正面 + */ + @Excel(name = "身份证正面", width = 15) + @ApiModelProperty(value = "身份证正面") + private java.lang.String cardZmPath; + /** + * 身份证反面 + */ + @Excel(name = "身份证反面", width = 15) + @ApiModelProperty(value = "身份证反面") + private java.lang.String cardFmPath; + /** + * 营业执照照片 + */ + @Excel(name = "营业执照照片", width = 15) + @ApiModelProperty(value = "营业执照照片") + private java.lang.String comBusinessLicense; + /** + * 企业名称 + */ + @Excel(name = "企业名称", width = 15) + @ApiModelProperty(value = "企业名称") + private java.lang.String comName; + /** + * 企业注册地址 + */ + @Excel(name = "企业注册地址", width = 15) + @ApiModelProperty(value = "企业注册地址") + private java.lang.String comRegisterAddress; + /** + * 企业信用代码 + */ + @Excel(name = "企业信用代码", width = 15) + @ApiModelProperty(value = "企业信用代码") + private java.lang.String comCreditCode; + /** + * 企业法人 + */ + @Excel(name = "企业法人", width = 15) + @ApiModelProperty(value = "企业法人") + private java.lang.String comLegalPerson; + /** + * 机构地址 + */ + @Excel(name = "机构地址", width = 15) + @ApiModelProperty(value = "机构地址") + private java.lang.String orgAddress; + /** + * 机构位置坐标:经度 + */ + @Excel(name = "机构位置坐标:经度", width = 15) + @ApiModelProperty(value = "机构位置坐标:经度") + private String orgCoordinateLo; + /** + * 机构位置坐标:纬度 + */ + @Excel(name = "机构位置坐标:纬度", width = 15) + @ApiModelProperty(value = "机构位置坐标:纬度") + private String orgCoordinateLa; + /** + * 机构负责人 + */ + @Excel(name = "机构负责人", width = 15) + @ApiModelProperty(value = "机构负责人") + private java.lang.String orgLeader; + /** + * 机构负责人电话 + */ + @Excel(name = "机构负责人电话", width = 15) + @ApiModelProperty(value = "机构负责人电话") + private java.lang.String orgLeaderPhone; + /** + * 机构楼宇牌号 + */ + @Excel(name = "机构楼宇牌号", width = 15) + @ApiModelProperty(value = "机构楼宇牌号") + private java.lang.String orgBuildingNumber; + /** + * 机构房屋性质 + */ + @Excel(name = "机构房屋性质", width = 15) + @ApiModelProperty(value = "机构房屋性质") + private java.lang.String orgPropertyType; + /** + * 机构建筑面积 + */ + @Excel(name = "机构建筑面积", width = 15) + @ApiModelProperty(value = "机构建筑面积") + private java.lang.Double orgBuildingArea; + /** + * 机构省份 sys_category.id + */ + @Excel(name = "机构省份", width = 15) + @ApiModelProperty(value = "机构省份") + @Dict(dictTable = "sys_category", dicCode = "id", dicText = "name") + private java.lang.String orgProvince; + /** + * 机构城市 sys_category.id + */ + @Excel(name = "机构城市", width = 15) + @ApiModelProperty(value = "机构城市") + @Dict(dictTable = "sys_category", dicCode = "id", dicText = "name") + private java.lang.String orgCity; + /** + * 机构区域 sys_category.id + */ + @Excel(name = "机构区域", width = 15) + @ApiModelProperty(value = "机构区域") + @Dict(dictTable = "sys_category", dicCode = "id", dicText = "name") + private java.lang.String orgDistrict; + //update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增字段负责人ids和旧的负责人ids /** * 部门负责人的ids @@ -243,66 +503,17 @@ public class SysDepart implements Serializable { private String oldDirectorUserIds; //update-end---author:wangshuai ---date:20200308 for:[JTC-119]新增字段负责人ids和旧的负责人ids - /** - * 重写equals方法 - */ + @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - if (!super.equals(o)) { - return false; - } - SysDepart depart = (SysDepart) o; - return Objects.equals(id, depart.id) && - Objects.equals(parentId, depart.parentId) && - Objects.equals(departName, depart.departName) && - Objects.equals(departNameEn, depart.departNameEn) && - Objects.equals(departNameAbbr, depart.departNameAbbr) && - Objects.equals(departOrder, depart.departOrder) && - Objects.equals(description, depart.description) && - Objects.equals(orgCategory, depart.orgCategory) && - Objects.equals(orgType, depart.orgType) && - Objects.equals(orgCode, depart.orgCode) && - Objects.equals(url, depart.url) && - Objects.equals(contextPath, depart.contextPath) && - Objects.equals(izDirectiveMain, depart.izDirectiveMain) && - Objects.equals(izElderTagMain, depart.izElderTagMain) && - Objects.equals(mediaUrl, depart.mediaUrl) && - Objects.equals(province, depart.province) && - Objects.equals(city, depart.city) && - Objects.equals(district, depart.district) && - Objects.equals(operationStartTime, depart.operationStartTime) && - Objects.equals(operationEndTime, depart.operationEndTime) && - Objects.equals(contractStartTime, depart.contractStartTime) && - Objects.equals(contractEndTime, depart.contractEndTime) && - Objects.equals(mobile, depart.mobile) && - Objects.equals(fax, depart.fax) && - Objects.equals(address, depart.address) && - Objects.equals(memo, depart.memo) && - Objects.equals(status, depart.status) && - Objects.equals(delFlag, depart.delFlag) && - Objects.equals(createBy, depart.createBy) && - Objects.equals(createTime, depart.createTime) && - Objects.equals(updateBy, depart.updateBy) && - Objects.equals(tenantId, depart.tenantId) && - Objects.equals(payableAmount, depart.payableAmount) && - Objects.equals(updateTime, depart.updateTime); + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SysDepart sysDepart = (SysDepart) o; + return Objects.equals(id, sysDepart.id) && Objects.equals(parentId, sysDepart.parentId) && Objects.equals(departName, sysDepart.departName) && Objects.equals(departNameEn, sysDepart.departNameEn) && Objects.equals(departNameAbbr, sysDepart.departNameAbbr) && Objects.equals(departOrder, sysDepart.departOrder) && Objects.equals(description, sysDepart.description) && Objects.equals(orgCategory, sysDepart.orgCategory) && Objects.equals(orgType, sysDepart.orgType) && Objects.equals(orgCode, sysDepart.orgCode) && Objects.equals(url, sysDepart.url) && Objects.equals(contextPath, sysDepart.contextPath) && Objects.equals(izDirectiveMain, sysDepart.izDirectiveMain) && Objects.equals(izElderTagMain, sysDepart.izElderTagMain) && Objects.equals(mediaUrl, sysDepart.mediaUrl) && Objects.equals(province, sysDepart.province) && Objects.equals(city, sysDepart.city) && Objects.equals(district, sysDepart.district) && Objects.equals(platType, sysDepart.platType) && Objects.equals(operationStartTime, sysDepart.operationStartTime) && Objects.equals(operationEndTime, sysDepart.operationEndTime) && Objects.equals(contractStartTime, sysDepart.contractStartTime) && Objects.equals(contractEndTime, sysDepart.contractEndTime) && Objects.equals(mobile, sysDepart.mobile) && Objects.equals(fax, sysDepart.fax) && Objects.equals(address, sysDepart.address) && Objects.equals(memo, sysDepart.memo) && Objects.equals(payableAmount, sysDepart.payableAmount) && Objects.equals(status, sysDepart.status) && Objects.equals(delFlag, sysDepart.delFlag) && Objects.equals(qywxIdentifier, sysDepart.qywxIdentifier) && Objects.equals(dingIdentifier, sysDepart.dingIdentifier) && Objects.equals(createBy, sysDepart.createBy) && Objects.equals(createTime, sysDepart.createTime) && Objects.equals(updateBy, sysDepart.updateBy) && Objects.equals(updateTime, sysDepart.updateTime) && Objects.equals(tenantId, sysDepart.tenantId) && Objects.equals(izLeaf, sysDepart.izLeaf) && Objects.equals(serverUrl, sysDepart.serverUrl) && Objects.equals(shareUrl, sysDepart.shareUrl) && Objects.equals(picUrl, sysDepart.picUrl) && Objects.equals(franchiseTime, sysDepart.franchiseTime) && Objects.equals(orgStatus, sysDepart.orgStatus) && Objects.equals(htCommitTime, sysDepart.htCommitTime) && Objects.equals(htCommitBy, sysDepart.htCommitBy) && Objects.equals(contract, sysDepart.contract) && Objects.equals(contractNote, sysDepart.contractNote) && Objects.equals(workOrderStatus, sysDepart.workOrderStatus) && Objects.equals(workOrderId, sysDepart.workOrderId) && Objects.equals(replyContent, sysDepart.replyContent) && Objects.equals(replyFile, sysDepart.replyFile) && Objects.equals(replyTime, sysDepart.replyTime) && Objects.equals(handleBy, sysDepart.handleBy) && Objects.equals(openId, sysDepart.openId) && Objects.equals(wechatName, sysDepart.wechatName) && Objects.equals(tel, sysDepart.tel) && Objects.equals(name, sysDepart.name) && Objects.equals(sex, sysDepart.sex) && Objects.equals(national, sysDepart.national) && Objects.equals(birthDate, sysDepart.birthDate) && Objects.equals(idCardAddress, sysDepart.idCardAddress) && Objects.equals(idCard, sysDepart.idCard) && Objects.equals(issuingAuthority, sysDepart.issuingAuthority) && Objects.equals(startTime, sysDepart.startTime) && Objects.equals(endTime, sysDepart.endTime) && Objects.equals(cardZmPath, sysDepart.cardZmPath) && Objects.equals(cardFmPath, sysDepart.cardFmPath) && Objects.equals(comBusinessLicense, sysDepart.comBusinessLicense) && Objects.equals(comName, sysDepart.comName) && Objects.equals(comRegisterAddress, sysDepart.comRegisterAddress) && Objects.equals(comCreditCode, sysDepart.comCreditCode) && Objects.equals(comLegalPerson, sysDepart.comLegalPerson) && Objects.equals(orgAddress, sysDepart.orgAddress) && Objects.equals(orgCoordinateLo, sysDepart.orgCoordinateLo) && Objects.equals(orgCoordinateLa, sysDepart.orgCoordinateLa) && Objects.equals(orgLeader, sysDepart.orgLeader) && Objects.equals(orgLeaderPhone, sysDepart.orgLeaderPhone) && Objects.equals(orgBuildingNumber, sysDepart.orgBuildingNumber) && Objects.equals(orgPropertyType, sysDepart.orgPropertyType) && Objects.equals(orgBuildingArea, sysDepart.orgBuildingArea) && Objects.equals(orgProvince, sysDepart.orgProvince) && Objects.equals(orgCity, sysDepart.orgCity) && Objects.equals(orgDistrict, sysDepart.orgDistrict); } - /** - * 重写hashCode方法 - */ @Override public int hashCode() { - return Objects.hash(super.hashCode(), id, parentId, departName, - departNameEn, departNameAbbr, departOrder, description, orgCategory, - orgType, orgCode, url, contextPath, izDirectiveMain,izElderTagMain, mediaUrl, province, city, district, operationStartTime, - operationEndTime, contractStartTime, contractEndTime, mobile, fax, address, memo, status, - delFlag, createBy, createTime, updateBy, updateTime, tenantId, payableAmount); + return Objects.hash(id, parentId, departName, departNameEn, departNameAbbr, departOrder, description, orgCategory, orgType, orgCode, url, contextPath, izDirectiveMain, izElderTagMain, mediaUrl, province, city, district, platType, operationStartTime, operationEndTime, contractStartTime, contractEndTime, mobile, fax, address, memo, payableAmount, status, delFlag, qywxIdentifier, dingIdentifier, createBy, createTime, updateBy, updateTime, tenantId, izLeaf, serverUrl, shareUrl, picUrl, franchiseTime, orgStatus, htCommitTime, htCommitBy, contract, contractNote, workOrderStatus, workOrderId, replyContent, replyFile, replyTime, handleBy, openId, wechatName, tel, name, sex, national, birthDate, idCardAddress, idCard, issuingAuthority, startTime, endTime, cardZmPath, cardFmPath, comBusinessLicense, comName, comRegisterAddress, comCreditCode, comLegalPerson, orgAddress, orgCoordinateLo, orgCoordinateLa, orgLeader, orgLeaderPhone, orgBuildingNumber, orgPropertyType, orgBuildingArea, orgProvince, orgCity, orgDistrict); } } diff --git a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java index 52d03d9..e8a70a9 100644 --- a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java +++ b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java @@ -211,4 +211,5 @@ public class SysUser implements Serializable { */ @TableField(exist = false) private boolean izBindThird; + } diff --git a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java index e5a681d..49f5e33 100644 --- a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java +++ b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/ISysDepartService.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.system.entity.SysDepartEntity; import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.model.DepartIdModel; import org.jeecg.modules.system.model.SysDepartTreeModel; @@ -243,4 +244,6 @@ public interface ISysDepartService extends IService{ void changeDirectiveMain(String orgCode); void changeElderTagMain(String orgCode); + + List queryAllAuditPassOrg(SysDepartEntity queryParams); } diff --git a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java index 0b968dc..81748b9 100644 --- a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java +++ b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java @@ -1,7 +1,6 @@ package org.jeecg.modules.system.service.impl; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.ListUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -14,7 +13,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.base.Joiner; import com.google.common.collect.Maps; import org.apache.commons.compress.utils.Lists; -import org.apache.commons.lang3.ArrayUtils; import org.jeecg.common.system.api.ISysBaseAPI; import org.jeecg.common.system.entity.SysDepartEntity; import org.jeecg.modules.message.entity.SysMessageTemplate; @@ -57,9 +55,6 @@ import org.jeecg.common.util.dynamic.db.FreemarkerParseFactory; import org.jeecg.common.util.oConvertUtils; import org.jeecg.config.firewall.SqlInjection.IDictTableWhiteListHandler; import org.jeecg.config.mybatis.MybatisPlusSaasConfig; -import org.jeecg.modules.system.entity.*; -import org.jeecg.modules.system.mapper.*; -import org.jeecg.modules.system.service.*; import org.jetbrains.annotations.Nullable; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -73,7 +68,6 @@ import org.springframework.util.PathMatcher; import javax.annotation.Resource; import javax.sql.DataSource; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.sql.Connection; @@ -1970,12 +1964,24 @@ public class SysBaseApiImpl implements ISysBaseAPI { } @Override - public SysDepartModel selectDepartById(String id) { + public SysDepartEntity selectDepartById(String id) { SysDepart depart = sysDepartService.getDepartById(id); - SysDepartModel sysDepartModel = new SysDepartModel(); + SysDepartEntity result = new SysDepartEntity(); if (depart != null) { - BeanUtils.copyProperties(depart, sysDepartModel); + BeanUtils.copyProperties(depart, result); } - return sysDepartModel; + return result; + } + + @Override + public List queryAllAuditPassOrg(SysDepartEntity queryParams){ + return sysDepartService.queryAllAuditPassOrg(queryParams); + } + + @Override + public void updateById(SysDepartEntity sysDepartEntity) { + SysDepart sysDepart = new SysDepart(); + BeanUtils.copyProperties(sysDepartEntity,sysDepart); + sysDepartService.updateById(sysDepart); } } diff --git a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java index 6ad5cb9..63e394c 100644 --- a/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java +++ b/nursing-unit-system/nu-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.system.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ArrayUtil; import com.alibaba.fastjson.JSONArray; @@ -17,6 +18,7 @@ import org.jeecg.common.config.TenantContext; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.FillRuleConstant; import org.jeecg.common.constant.SymbolConstant; +import org.jeecg.common.system.entity.SysDepartEntity; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.FillRuleUtil; import org.jeecg.common.util.ImportExcelUtil; @@ -52,526 +54,533 @@ import java.util.stream.Collectors; @Service public class SysDepartServiceImpl extends ServiceImpl implements ISysDepartService { - @Autowired - private SysUserDepartMapper userDepartMapper; - @Autowired - private SysDepartRoleMapper sysDepartRoleMapper; - @Autowired - private SysDepartPermissionMapper departPermissionMapper; - @Autowired - private SysDepartRolePermissionMapper departRolePermissionMapper; - @Autowired - private SysDepartRoleUserMapper departRoleUserMapper; - @Autowired - private SysUserMapper sysUserMapper; - @Autowired - private SysDepartMapper departMapper; + @Autowired + private SysUserDepartMapper userDepartMapper; + @Autowired + private SysDepartRoleMapper sysDepartRoleMapper; + @Autowired + private SysDepartPermissionMapper departPermissionMapper; + @Autowired + private SysDepartRolePermissionMapper departRolePermissionMapper; + @Autowired + private SysDepartRoleUserMapper departRoleUserMapper; + @Autowired + private SysUserMapper sysUserMapper; + @Autowired + private SysDepartMapper departMapper; - @Override - public List queryMyDeptTreeList(String departIds) { - //根据部门id获取所负责部门 - LambdaQueryWrapper query = new LambdaQueryWrapper(); - String[] codeArr = this.getMyDeptParentOrgCode(departIds); - //update-begin---author:wangshuai---date:2023-12-01---for:【QQYUN-7320】查询部门没数据,导致报错空指针--- - if(ArrayUtil.isEmpty(codeArr)){ - return null; - } - //update-end---author:wangshuai---date:2023-12-01---for:【QQYUN-7320】查询部门没数据,导致报错空指针--- - for(int i=0;i queryMyDeptTreeList(String departIds) { + //根据部门id获取所负责部门 + LambdaQueryWrapper query = new LambdaQueryWrapper(); + String[] codeArr = this.getMyDeptParentOrgCode(departIds); + //update-begin---author:wangshuai---date:2023-12-01---for:【QQYUN-7320】查询部门没数据,导致报错空指针--- + if (ArrayUtil.isEmpty(codeArr)) { + return null; + } + //update-end---author:wangshuai---date:2023-12-01---for:【QQYUN-7320】查询部门没数据,导致报错空指针--- + for (int i = 0; i < codeArr.length; i++) { + query.or().likeRight(SysDepart::getOrgCode, codeArr[i]); + } + query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); - //------------------------------------------------------------------------------------------------ - //是否开启系统管理模块的 SASS 控制 - if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ - query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); - } - //------------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------------ + //是否开启系统管理模块的 SASS 控制 + if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { + query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); + } + //------------------------------------------------------------------------------------------------ - query.orderByAsc(SysDepart::getDepartOrder); - //将父节点ParentId设为null - List listDepts = this.list(query); - for(int i=0;i listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(listDepts); - return listResult; - } + query.orderByAsc(SysDepart::getDepartOrder); + //将父节点ParentId设为null + List listDepts = this.list(query); + for (int i = 0; i < codeArr.length; i++) { + for (SysDepart dept : listDepts) { + if (dept.getOrgCode().equals(codeArr[i])) { + dept.setParentId(null); + } + } + } + // 调用wrapTreeDataToTreeList方法生成树状数据 + List listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(listDepts); + return listResult; + } - /** - * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端 - */ - @Override - //@Cacheable(value = CacheConstant.SYS_DEPARTS_CACHE) - public List queryTreeList() { - LambdaQueryWrapper query = new LambdaQueryWrapper(); - //------------------------------------------------------------------------------------------------ - //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 - if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ - query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); - } - //------------------------------------------------------------------------------------------------ - query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); - query.orderByAsc(SysDepart::getDepartOrder); - List list = this.list(query); + /** + * queryTreeList 对应 queryTreeList 查询所有的部门数据,以树结构形式响应给前端 + */ + @Override + //@Cacheable(value = CacheConstant.SYS_DEPARTS_CACHE) + public List queryTreeList() { + LambdaQueryWrapper query = new LambdaQueryWrapper(); + //------------------------------------------------------------------------------------------------ + //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 + if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { + query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); + } + //------------------------------------------------------------------------------------------------ + query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); + query.orderByAsc(SysDepart::getDepartOrder); + List list = this.list(query); //update-begin---author:wangshuai ---date:20220307 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 - //设置用户id,让前台显示 + //设置用户id,让前台显示 this.setUserIdsByDepList(list); //update-begin---author:wangshuai ---date:20220307 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 - // 调用wrapTreeDataToTreeList方法生成树状数据 - List listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list); - return listResult; - } + // 调用wrapTreeDataToTreeList方法生成树状数据 + List listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list); + return listResult; + } - /** - * queryTreeList 根据部门id查询,前端回显调用 - */ - @Override - public List queryTreeList(String ids) { - List listResult=new ArrayList<>(); - LambdaQueryWrapper query = new LambdaQueryWrapper(); - query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); - if(oConvertUtils.isNotEmpty(ids)){ - query.in(true,SysDepart::getId,ids.split(",")); - } - //------------------------------------------------------------------------------------------------ - //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 - if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ - query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); - } - //------------------------------------------------------------------------------------------------ - query.orderByAsc(SysDepart::getDepartOrder); - List list= this.list(query); - for (SysDepart depart : list) { - listResult.add(new SysDepartTreeModel(depart)); - } - return listResult; + /** + * queryTreeList 根据部门id查询,前端回显调用 + */ + @Override + public List queryTreeList(String ids) { + List listResult = new ArrayList<>(); + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); + if (oConvertUtils.isNotEmpty(ids)) { + query.in(true, SysDepart::getId, ids.split(",")); + } + //------------------------------------------------------------------------------------------------ + //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 + if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { + query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); + } + //------------------------------------------------------------------------------------------------ + query.orderByAsc(SysDepart::getDepartOrder); + List list = this.list(query); + for (SysDepart depart : list) { + listResult.add(new SysDepartTreeModel(depart)); + } + return listResult; - } + } - //@Cacheable(value = CacheConstant.SYS_DEPART_IDS_CACHE) - @Override - public List queryDepartIdTreeList() { - LambdaQueryWrapper query = new LambdaQueryWrapper(); - query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); - //------------------------------------------------------------------------------------------------ - //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 - if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ - query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); - } - //------------------------------------------------------------------------------------------------ - query.orderByAsc(SysDepart::getDepartOrder); - List list = this.list(query); - // 调用wrapTreeDataToTreeList方法生成树状数据 - List listResult = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list); - return listResult; - } + //@Cacheable(value = CacheConstant.SYS_DEPART_IDS_CACHE) + @Override + public List queryDepartIdTreeList() { + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); + //------------------------------------------------------------------------------------------------ + //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 + if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { + query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); + } + //------------------------------------------------------------------------------------------------ + query.orderByAsc(SysDepart::getDepartOrder); + List list = this.list(query); + // 调用wrapTreeDataToTreeList方法生成树状数据 + List listResult = FindsDepartsChildrenUtil.wrapTreeDataToDepartIdTreeList(list); + return listResult; + } - /** - * saveDepartData 对应 add 保存用户在页面添加的新的部门对象数据 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void saveDepartData(SysDepart sysDepart, String username) { - if (sysDepart != null && username != null) { - //update-begin---author:wangshuai ---date:20230216 for:[QQYUN-4163]给部门表加个是否有子节点------------ - if (oConvertUtils.isEmpty(sysDepart.getParentId())) { - sysDepart.setParentId(""); - }else{ - //将父部门的设成不是叶子结点 - departMapper.setMainLeaf(sysDepart.getParentId(),CommonConstant.NOT_LEAF); - } - //update-end---author:wangshuai ---date:20230216 for:[QQYUN-4163]给部门表加个是否有子节点------------ - //String s = UUID.randomUUID().toString().replace("-", ""); - sysDepart.setId(IdWorker.getIdStr(sysDepart)); - // 先判断该对象有无父级ID,有则意味着不是最高级,否则意味着是最高级 - // 获取父级ID - String parentId = sysDepart.getParentId(); - //update-begin--Author:baihailong Date:20191209 for:部门编码规则生成器做成公用配置 - JSONObject formData = new JSONObject(); - formData.put("parentId",parentId); - String[] codeArray = (String[]) FillRuleUtil.executeRule(FillRuleConstant.DEPART,formData); - //update-end--Author:baihailong Date:20191209 for:部门编码规则生成器做成公用配置 - sysDepart.setOrgCode(codeArray[0]); - String orgType = codeArray[1]; - sysDepart.setOrgType(String.valueOf(orgType)); - sysDepart.setCreateTime(new Date()); - sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); - //新添加的部门是叶子节点 - sysDepart.setIzLeaf(CommonConstant.IS_LEAF); - // 【QQYUN-7172】数据库默认值兼容 - if (oConvertUtils.isEmpty(sysDepart.getOrgCategory())) { - if (oConvertUtils.isEmpty(sysDepart.getParentId())) { - sysDepart.setOrgCategory("1"); - } else { - sysDepart.setOrgCategory("2"); - } - } - this.save(sysDepart); + /** + * saveDepartData 对应 add 保存用户在页面添加的新的部门对象数据 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveDepartData(SysDepart sysDepart, String username) { + if (sysDepart != null && username != null) { + //update-begin---author:wangshuai ---date:20230216 for:[QQYUN-4163]给部门表加个是否有子节点------------ + if (oConvertUtils.isEmpty(sysDepart.getParentId())) { + sysDepart.setParentId(""); + } else { + //将父部门的设成不是叶子结点 + departMapper.setMainLeaf(sysDepart.getParentId(), CommonConstant.NOT_LEAF); + } + //update-end---author:wangshuai ---date:20230216 for:[QQYUN-4163]给部门表加个是否有子节点------------ + //String s = UUID.randomUUID().toString().replace("-", ""); + sysDepart.setId(IdWorker.getIdStr(sysDepart)); + // 先判断该对象有无父级ID,有则意味着不是最高级,否则意味着是最高级 + // 获取父级ID + String parentId = sysDepart.getParentId(); + //update-begin--Author:baihailong Date:20191209 for:部门编码规则生成器做成公用配置 + JSONObject formData = new JSONObject(); + formData.put("parentId", parentId); + String[] codeArray = (String[]) FillRuleUtil.executeRule(FillRuleConstant.DEPART, formData); + //update-end--Author:baihailong Date:20191209 for:部门编码规则生成器做成公用配置 + sysDepart.setOrgCode(codeArray[0]); + String orgType = codeArray[1]; + sysDepart.setOrgType(String.valueOf(orgType)); + sysDepart.setCreateTime(new Date()); + sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); + //新添加的部门是叶子节点 + sysDepart.setIzLeaf(CommonConstant.IS_LEAF); + // 【QQYUN-7172】数据库默认值兼容 + if (oConvertUtils.isEmpty(sysDepart.getOrgCategory())) { + if (oConvertUtils.isEmpty(sysDepart.getParentId())) { + sysDepart.setOrgCategory("1"); + } else { + sysDepart.setOrgCategory("2"); + } + } + this.save(sysDepart); //update-begin---author:wangshuai ---date:20220307 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 - //新增部门的时候新增负责部门 - if(oConvertUtils.isNotEmpty(sysDepart.getDirectorUserIds())){ - this.addDepartByUserIds(sysDepart,sysDepart.getDirectorUserIds()); + //新增部门的时候新增负责部门 + if (oConvertUtils.isNotEmpty(sysDepart.getDirectorUserIds())) { + this.addDepartByUserIds(sysDepart, sysDepart.getDirectorUserIds()); } //update-end---author:wangshuai ---date:20220307 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 - } + } - } + } - /** - * saveDepartData 的调用方法,生成部门编码和部门类型(作废逻辑) - * @deprecated - * @param parentId - * @return - */ - private String[] generateOrgCode(String parentId) { - //update-begin--Author:Steve Date:20190201 for:组织机构添加数据代码调整 - LambdaQueryWrapper query = new LambdaQueryWrapper(); - LambdaQueryWrapper query1 = new LambdaQueryWrapper(); - String[] strArray = new String[2]; - // 创建一个List集合,存储查询返回的所有SysDepart对象 - List departList = new ArrayList<>(); - // 定义新编码字符串 - String newOrgCode = ""; - // 定义旧编码字符串 - String oldOrgCode = ""; - // 定义部门类型 - String orgType = ""; - // 如果是最高级,则查询出同级的org_code, 调用工具类生成编码并返回 - if (StringUtil.isNullOrEmpty(parentId)) { - // 线判断数据库中的表是否为空,空则直接返回初始编码 - query1.eq(SysDepart::getParentId, "").or().isNull(SysDepart::getParentId); - query1.orderByDesc(SysDepart::getOrgCode); - departList = this.list(query1); - if(departList == null || departList.size() == 0) { - strArray[0] = YouBianCodeUtil.getNextYouBianCode(null); - strArray[1] = "1"; - return strArray; - }else { - SysDepart depart = departList.get(0); - oldOrgCode = depart.getOrgCode(); - orgType = depart.getOrgType(); - newOrgCode = YouBianCodeUtil.getNextYouBianCode(oldOrgCode); - } - } else { // 反之则查询出所有同级的部门,获取结果后有两种情况,有同级和没有同级 - // 封装查询同级的条件 - query.eq(SysDepart::getParentId, parentId); - // 降序排序 - query.orderByDesc(SysDepart::getOrgCode); - // 查询出同级部门的集合 - List parentList = this.list(query); - // 查询出父级部门 - SysDepart depart = this.getById(parentId); - // 获取父级部门的Code - String parentCode = depart.getOrgCode(); - // 根据父级部门类型算出当前部门的类型 - orgType = String.valueOf(Integer.valueOf(depart.getOrgType()) + 1); - // 处理同级部门为null的情况 - if (parentList == null || parentList.size() == 0) { - // 直接生成当前的部门编码并返回 - newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, null); - } else { //处理有同级部门的情况 - // 获取同级部门的编码,利用工具类 - String subCode = parentList.get(0).getOrgCode(); - // 返回生成的当前部门编码 - newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, subCode); - } - } - // 返回最终封装了部门编码和部门类型的数组 - strArray[0] = newOrgCode; - strArray[1] = orgType; - return strArray; - //update-end--Author:Steve Date:20190201 for:组织机构添加数据代码调整 - } + /** + * saveDepartData 的调用方法,生成部门编码和部门类型(作废逻辑) + * + * @param parentId + * @return + * @deprecated + */ + private String[] generateOrgCode(String parentId) { + //update-begin--Author:Steve Date:20190201 for:组织机构添加数据代码调整 + LambdaQueryWrapper query = new LambdaQueryWrapper(); + LambdaQueryWrapper query1 = new LambdaQueryWrapper(); + String[] strArray = new String[2]; + // 创建一个List集合,存储查询返回的所有SysDepart对象 + List departList = new ArrayList<>(); + // 定义新编码字符串 + String newOrgCode = ""; + // 定义旧编码字符串 + String oldOrgCode = ""; + // 定义部门类型 + String orgType = ""; + // 如果是最高级,则查询出同级的org_code, 调用工具类生成编码并返回 + if (StringUtil.isNullOrEmpty(parentId)) { + // 线判断数据库中的表是否为空,空则直接返回初始编码 + query1.eq(SysDepart::getParentId, "").or().isNull(SysDepart::getParentId); + query1.orderByDesc(SysDepart::getOrgCode); + departList = this.list(query1); + if (departList == null || departList.size() == 0) { + strArray[0] = YouBianCodeUtil.getNextYouBianCode(null); + strArray[1] = "1"; + return strArray; + } else { + SysDepart depart = departList.get(0); + oldOrgCode = depart.getOrgCode(); + orgType = depart.getOrgType(); + newOrgCode = YouBianCodeUtil.getNextYouBianCode(oldOrgCode); + } + } else { // 反之则查询出所有同级的部门,获取结果后有两种情况,有同级和没有同级 + // 封装查询同级的条件 + query.eq(SysDepart::getParentId, parentId); + // 降序排序 + query.orderByDesc(SysDepart::getOrgCode); + // 查询出同级部门的集合 + List parentList = this.list(query); + // 查询出父级部门 + SysDepart depart = this.getById(parentId); + // 获取父级部门的Code + String parentCode = depart.getOrgCode(); + // 根据父级部门类型算出当前部门的类型 + orgType = String.valueOf(Integer.valueOf(depart.getOrgType()) + 1); + // 处理同级部门为null的情况 + if (parentList == null || parentList.size() == 0) { + // 直接生成当前的部门编码并返回 + newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, null); + } else { //处理有同级部门的情况 + // 获取同级部门的编码,利用工具类 + String subCode = parentList.get(0).getOrgCode(); + // 返回生成的当前部门编码 + newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, subCode); + } + } + // 返回最终封装了部门编码和部门类型的数组 + strArray[0] = newOrgCode; + strArray[1] = orgType; + return strArray; + //update-end--Author:Steve Date:20190201 for:组织机构添加数据代码调整 + } - /** - * removeDepartDataById 对应 delete方法 根据ID删除相关部门数据 - * - */ - /* - * @Override - * - * @Transactional public boolean removeDepartDataById(String id) { - * System.out.println("要删除的ID 为=============================>>>>>"+id); boolean - * flag = this.removeById(id); return flag; } - */ + /** + * removeDepartDataById 对应 delete方法 根据ID删除相关部门数据 + * + */ + /* + * @Override + * + * @Transactional public boolean removeDepartDataById(String id) { + * System.out.println("要删除的ID 为=============================>>>>>"+id); boolean + * flag = this.removeById(id); return flag; } + */ - /** - * updateDepartDataById 对应 edit 根据部门主键来更新对应的部门数据 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Boolean updateDepartDataById(SysDepart sysDepart, String username) { - if (sysDepart != null && username != null) { - sysDepart.setUpdateTime(new Date()); - sysDepart.setUpdateBy(username); - this.updateById(sysDepart); + /** + * updateDepartDataById 对应 edit 根据部门主键来更新对应的部门数据 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean updateDepartDataById(SysDepart sysDepart, String username) { + if (sysDepart != null && username != null) { + sysDepart.setUpdateTime(new Date()); + sysDepart.setUpdateBy(username); + this.updateById(sysDepart); //update-begin---author:wangshuai ---date:20220307 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 - //修改部门管理的时候,修改负责部门 + //修改部门管理的时候,修改负责部门 this.updateChargeDepart(sysDepart); //update-begin---author:wangshuai ---date:20220307 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 - return true; - } else { - return false; - } + return true; + } else { + return false; + } - } + } - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteBatchWithChildren(List ids) { - //存放子级的id - List idList = new ArrayList(); - //存放父级的id - List parentIdList = new ArrayList<>(); - for(String id: ids) { - idList.add(id); - //此步骤是为了删除子级 - this.checkChildrenExists(id, idList); - //update-begin---author:wangshuai ---date:20230712 for:【QQYUN-5757】批量删除部门时未正确置为叶子节点 ------------ - SysDepart depart = this.getDepartById(id); - if (oConvertUtils.isNotEmpty(depart.getParentId())) { - if (!parentIdList.contains(depart.getParentId())) { - parentIdList.add(depart.getParentId()); - } - } - //update-end---author:wangshuai ---date:20230712 for:【QQYUN-5757】批量删除部门时未正确置为叶子节点 ------------ - } - this.removeByIds(idList); - //update-begin---author:wangshuai ---date:20230712 for:【QQYUN-5757】批量删除部门时未正确置为叶子节点 ------------ - //再删除前需要获取父级id,不然会一直为空 - this.setParentDepartIzLeaf(parentIdList); - //update-end---author:wangshuai ---date:20230712 for:【QQYUN-5757】批量删除部门时未正确置为叶子节点 ------------ - //根据部门id获取部门角色id - List roleIdList = new ArrayList<>(); - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.select(SysDepartRole::getId).in(SysDepartRole::getDepartId, idList); - List depRoleList = sysDepartRoleMapper.selectList(query); - for(SysDepartRole deptRole : depRoleList){ - roleIdList.add(deptRole.getId()); - } - //根据部门id删除用户与部门关系 - userDepartMapper.delete(new LambdaQueryWrapper().in(SysUserDepart::getDepId,idList)); - //根据部门id删除部门授权 - departPermissionMapper.delete(new LambdaQueryWrapper().in(SysDepartPermission::getDepartId,idList)); - //根据部门id删除部门角色 - sysDepartRoleMapper.delete(new LambdaQueryWrapper().in(SysDepartRole::getDepartId,idList)); - if(roleIdList != null && roleIdList.size()>0){ - //根据角色id删除部门角色授权 - departRolePermissionMapper.delete(new LambdaQueryWrapper().in(SysDepartRolePermission::getRoleId,roleIdList)); - //根据角色id删除部门角色用户信息 - departRoleUserMapper.delete(new LambdaQueryWrapper().in(SysDepartRoleUser::getDroleId,roleIdList)); - } - } + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteBatchWithChildren(List ids) { + //存放子级的id + List idList = new ArrayList(); + //存放父级的id + List parentIdList = new ArrayList<>(); + for (String id : ids) { + idList.add(id); + //此步骤是为了删除子级 + this.checkChildrenExists(id, idList); + //update-begin---author:wangshuai ---date:20230712 for:【QQYUN-5757】批量删除部门时未正确置为叶子节点 ------------ + SysDepart depart = this.getDepartById(id); + if (oConvertUtils.isNotEmpty(depart.getParentId())) { + if (!parentIdList.contains(depart.getParentId())) { + parentIdList.add(depart.getParentId()); + } + } + //update-end---author:wangshuai ---date:20230712 for:【QQYUN-5757】批量删除部门时未正确置为叶子节点 ------------ + } + this.removeByIds(idList); + //update-begin---author:wangshuai ---date:20230712 for:【QQYUN-5757】批量删除部门时未正确置为叶子节点 ------------ + //再删除前需要获取父级id,不然会一直为空 + this.setParentDepartIzLeaf(parentIdList); + //update-end---author:wangshuai ---date:20230712 for:【QQYUN-5757】批量删除部门时未正确置为叶子节点 ------------ + //根据部门id获取部门角色id + List roleIdList = new ArrayList<>(); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.select(SysDepartRole::getId).in(SysDepartRole::getDepartId, idList); + List depRoleList = sysDepartRoleMapper.selectList(query); + for (SysDepartRole deptRole : depRoleList) { + roleIdList.add(deptRole.getId()); + } + //根据部门id删除用户与部门关系 + userDepartMapper.delete(new LambdaQueryWrapper().in(SysUserDepart::getDepId, idList)); + //根据部门id删除部门授权 + departPermissionMapper.delete(new LambdaQueryWrapper().in(SysDepartPermission::getDepartId, idList)); + //根据部门id删除部门角色 + sysDepartRoleMapper.delete(new LambdaQueryWrapper().in(SysDepartRole::getDepartId, idList)); + if (roleIdList != null && roleIdList.size() > 0) { + //根据角色id删除部门角色授权 + departRolePermissionMapper.delete(new LambdaQueryWrapper().in(SysDepartRolePermission::getRoleId, roleIdList)); + //根据角色id删除部门角色用户信息 + departRoleUserMapper.delete(new LambdaQueryWrapper().in(SysDepartRoleUser::getDroleId, roleIdList)); + } + } - @Override - public List getSubDepIdsByDepId(String departId) { - return this.baseMapper.getSubDepIdsByDepId(departId); - } + @Override + public List getSubDepIdsByDepId(String departId) { + return this.baseMapper.getSubDepIdsByDepId(departId); + } - @Override - public List getMySubDepIdsByDepId(String departIds) { - //根据部门id获取所负责部门 - String[] codeArr = this.getMyDeptParentOrgCode(departIds); - if(codeArr==null || codeArr.length==0){ - return null; - } - return this.baseMapper.getSubDepIdsByOrgCodes(codeArr); - } + @Override + public List getMySubDepIdsByDepId(String departIds) { + //根据部门id获取所负责部门 + String[] codeArr = this.getMyDeptParentOrgCode(departIds); + if (codeArr == null || codeArr.length == 0) { + return null; + } + return this.baseMapper.getSubDepIdsByOrgCodes(codeArr); + } - /** - *

- * 根据关键字搜索相关的部门数据 - *

- */ - @Override - public List searchByKeyWord(String keyWord,String myDeptSearch,String departIds) { - LambdaQueryWrapper query = new LambdaQueryWrapper(); - List newList = new ArrayList<>(); - //myDeptSearch不为空时为我的部门搜索,只搜索所负责部门 - if(!StringUtil.isNullOrEmpty(myDeptSearch)){ - //departIds 为空普通用户或没有管理部门 - if(StringUtil.isNullOrEmpty(departIds)){ - return newList; - } - //根据部门id获取所负责部门 - String[] codeArr = this.getMyDeptParentOrgCode(departIds); - //update-begin-author:taoyan date:20220104 for:/issues/3311 当用户属于两个部门的时候,且这两个部门没有上下级关系,我的部门-部门名称查询条件模糊搜索失效! - if (codeArr != null && codeArr.length > 0) { - query.nested(i -> { - for (String s : codeArr) { - i.or().likeRight(SysDepart::getOrgCode, s); - } - }); - } - //update-end-author:taoyan date:20220104 for:/issues/3311 当用户属于两个部门的时候,且这两个部门没有上下级关系,我的部门-部门名称查询条件模糊搜索失效! - query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); - } - query.like(SysDepart::getDepartName, keyWord); - //update-begin--Author:huangzhilin Date:20140417 for:[bugfree号]组织机构搜索回显优化-------------------- - SysDepartTreeModel model = new SysDepartTreeModel(); - List departList = this.list(query); - if(departList.size() > 0) { - for(SysDepart depart : departList) { - model = new SysDepartTreeModel(depart); - model.setChildren(null); - //update-end--Author:huangzhilin Date:20140417 for:[bugfree号]组织机构搜索功回显优化---------------------- - newList.add(model); - } - return newList; - } - return null; - } + /** + *

+ * 根据关键字搜索相关的部门数据 + *

+ */ + @Override + public List searchByKeyWord(String keyWord, String myDeptSearch, String departIds) { + LambdaQueryWrapper query = new LambdaQueryWrapper(); + List newList = new ArrayList<>(); + //myDeptSearch不为空时为我的部门搜索,只搜索所负责部门 + if (!StringUtil.isNullOrEmpty(myDeptSearch)) { + //departIds 为空普通用户或没有管理部门 + if (StringUtil.isNullOrEmpty(departIds)) { + return newList; + } + //根据部门id获取所负责部门 + String[] codeArr = this.getMyDeptParentOrgCode(departIds); + //update-begin-author:taoyan date:20220104 for:/issues/3311 当用户属于两个部门的时候,且这两个部门没有上下级关系,我的部门-部门名称查询条件模糊搜索失效! + if (codeArr != null && codeArr.length > 0) { + query.nested(i -> { + for (String s : codeArr) { + i.or().likeRight(SysDepart::getOrgCode, s); + } + }); + } + //update-end-author:taoyan date:20220104 for:/issues/3311 当用户属于两个部门的时候,且这两个部门没有上下级关系,我的部门-部门名称查询条件模糊搜索失效! + query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); + } + query.like(SysDepart::getDepartName, keyWord); + //update-begin--Author:huangzhilin Date:20140417 for:[bugfree号]组织机构搜索回显优化-------------------- + SysDepartTreeModel model = new SysDepartTreeModel(); + List departList = this.list(query); + if (departList.size() > 0) { + for (SysDepart depart : departList) { + model = new SysDepartTreeModel(depart); + model.setChildren(null); + //update-end--Author:huangzhilin Date:20140417 for:[bugfree号]组织机构搜索功回显优化---------------------- + newList.add(model); + } + return newList; + } + return null; + } - /** - * 根据部门id删除并且删除其可能存在的子级任何部门 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public boolean delete(String id) { - List idList = new ArrayList<>(); - idList.add(id); - this.checkChildrenExists(id, idList); - //清空部门树内存 - //FindsDepartsChildrenUtil.clearDepartIdModel(); - boolean ok = this.removeByIds(idList); - //根据部门id获取部门角色id - List roleIdList = new ArrayList<>(); - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.select(SysDepartRole::getId).in(SysDepartRole::getDepartId, idList); - List depRoleList = sysDepartRoleMapper.selectList(query); - for(SysDepartRole deptRole : depRoleList){ - roleIdList.add(deptRole.getId()); - } - //根据部门id删除用户与部门关系 - userDepartMapper.delete(new LambdaQueryWrapper().in(SysUserDepart::getDepId,idList)); - //根据部门id删除部门授权 - departPermissionMapper.delete(new LambdaQueryWrapper().in(SysDepartPermission::getDepartId,idList)); - //根据部门id删除部门角色 - sysDepartRoleMapper.delete(new LambdaQueryWrapper().in(SysDepartRole::getDepartId,idList)); - if(roleIdList != null && roleIdList.size()>0){ - //根据角色id删除部门角色授权 - departRolePermissionMapper.delete(new LambdaQueryWrapper().in(SysDepartRolePermission::getRoleId,roleIdList)); - //根据角色id删除部门角色用户信息 - departRoleUserMapper.delete(new LambdaQueryWrapper().in(SysDepartRoleUser::getDroleId,roleIdList)); - } - return ok; - } + /** + * 根据部门id删除并且删除其可能存在的子级任何部门 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean delete(String id) { + List idList = new ArrayList<>(); + idList.add(id); + this.checkChildrenExists(id, idList); + //清空部门树内存 + //FindsDepartsChildrenUtil.clearDepartIdModel(); + boolean ok = this.removeByIds(idList); + //根据部门id获取部门角色id + List roleIdList = new ArrayList<>(); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.select(SysDepartRole::getId).in(SysDepartRole::getDepartId, idList); + List depRoleList = sysDepartRoleMapper.selectList(query); + for (SysDepartRole deptRole : depRoleList) { + roleIdList.add(deptRole.getId()); + } + //根据部门id删除用户与部门关系 + userDepartMapper.delete(new LambdaQueryWrapper().in(SysUserDepart::getDepId, idList)); + //根据部门id删除部门授权 + departPermissionMapper.delete(new LambdaQueryWrapper().in(SysDepartPermission::getDepartId, idList)); + //根据部门id删除部门角色 + sysDepartRoleMapper.delete(new LambdaQueryWrapper().in(SysDepartRole::getDepartId, idList)); + if (roleIdList != null && roleIdList.size() > 0) { + //根据角色id删除部门角色授权 + departRolePermissionMapper.delete(new LambdaQueryWrapper().in(SysDepartRolePermission::getRoleId, roleIdList)); + //根据角色id删除部门角色用户信息 + departRoleUserMapper.delete(new LambdaQueryWrapper().in(SysDepartRoleUser::getDroleId, roleIdList)); + } + return ok; + } - /** - * delete 方法调用 - * @param id - * @param idList - */ - private void checkChildrenExists(String id, List idList) { - LambdaQueryWrapper query = new LambdaQueryWrapper(); - query.eq(SysDepart::getParentId,id); - List departList = this.list(query); - if(departList != null && departList.size() > 0) { - for(SysDepart depart : departList) { - idList.add(depart.getId()); - this.checkChildrenExists(depart.getId(), idList); - } - } - } + /** + * delete 方法调用 + * + * @param id + * @param idList + */ + private void checkChildrenExists(String id, List idList) { + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.eq(SysDepart::getParentId, id); + List departList = this.list(query); + if (departList != null && departList.size() > 0) { + for (SysDepart depart : departList) { + idList.add(depart.getId()); + this.checkChildrenExists(depart.getId(), idList); + } + } + } - @Override - public List queryUserDeparts(String userId) { - return baseMapper.queryUserDeparts(userId); - } + @Override + public List queryUserDeparts(String userId) { + return baseMapper.queryUserDeparts(userId); + } - @Override - public List queryDepartsByUsername(String username) { - return baseMapper.queryDepartsByUsername(username); - } + @Override + public List queryDepartsByUsername(String username) { + return baseMapper.queryDepartsByUsername(username); + } - @Override - public List queryDepartsByUserId(String userId) { - List list = baseMapper.queryDepartsByUserId(userId); - return list; - } + @Override + public List queryDepartsByUserId(String userId) { + List list = baseMapper.queryDepartsByUserId(userId); + return list; + } - /** - * 根据用户所负责部门ids获取父级部门编码 - * @param departIds - * @return - */ - private String[] getMyDeptParentOrgCode(String departIds){ - //根据部门id查询所负责部门 - LambdaQueryWrapper query = new LambdaQueryWrapper(); - query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); - if(oConvertUtils.isNotEmpty(departIds)){ - query.in(SysDepart::getId, Arrays.asList(departIds.split(","))); - } + /** + * 根据用户所负责部门ids获取父级部门编码 + * + * @param departIds + * @return + */ + private String[] getMyDeptParentOrgCode(String departIds) { + //根据部门id查询所负责部门 + LambdaQueryWrapper query = new LambdaQueryWrapper(); + query.eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); + if (oConvertUtils.isNotEmpty(departIds)) { + query.in(SysDepart::getId, Arrays.asList(departIds.split(","))); + } - //------------------------------------------------------------------------------------------------ - //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 - if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ - query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); - } - //------------------------------------------------------------------------------------------------ - query.orderByAsc(SysDepart::getOrgCode); - List list = this.list(query); - //查找根部门 - if(list == null || list.size()==0){ - return null; - } - String orgCode = this.getMyDeptParentNode(list); - String[] codeArr = orgCode.split(","); - return codeArr; - } + //------------------------------------------------------------------------------------------------ + //是否开启系统管理模块的多租户数据隔离【SAAS多租户模式】 + if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { + query.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); + } + //------------------------------------------------------------------------------------------------ + query.orderByAsc(SysDepart::getOrgCode); + List list = this.list(query); + //查找根部门 + if (list == null || list.size() == 0) { + return null; + } + String orgCode = this.getMyDeptParentNode(list); + String[] codeArr = orgCode.split(","); + return codeArr; + } - /** - * 获取负责部门父节点 - * @param list - * @return - */ - private String getMyDeptParentNode(List list){ - Map map = new HashMap(5); - //1.先将同一公司归类 - for(SysDepart dept : list){ - String code = dept.getOrgCode().substring(0,3); - if(map.containsKey(code)){ - String mapCode = map.get(code)+","+dept.getOrgCode(); - map.put(code,mapCode); - }else{ - map.put(code,dept.getOrgCode()); - } - } - StringBuffer parentOrgCode = new StringBuffer(); - //2.获取同一公司的根节点 - for(String str : map.values()){ - String[] arrStr = str.split(","); - parentOrgCode.append(",").append(this.getMinLengthNode(arrStr)); - } - return parentOrgCode.substring(1); - } + /** + * 获取负责部门父节点 + * + * @param list + * @return + */ + private String getMyDeptParentNode(List list) { + Map map = new HashMap(5); + //1.先将同一公司归类 + for (SysDepart dept : list) { + String code = dept.getOrgCode().substring(0, 3); + if (map.containsKey(code)) { + String mapCode = map.get(code) + "," + dept.getOrgCode(); + map.put(code, mapCode); + } else { + map.put(code, dept.getOrgCode()); + } + } + StringBuffer parentOrgCode = new StringBuffer(); + //2.获取同一公司的根节点 + for (String str : map.values()) { + String[] arrStr = str.split(","); + parentOrgCode.append(",").append(this.getMinLengthNode(arrStr)); + } + return parentOrgCode.substring(1); + } - /** - * 获取同一公司中部门编码长度最小的部门 - * @param str - * @return - */ - private String getMinLengthNode(String[] str){ - int min =str[0].length(); - StringBuilder orgCodeBuilder = new StringBuilder(str[0]); - for(int i =1;i list = this.list(query); // 调用wrapTreeDataToTreeList方法生成树状数据 List listResult = FindsDepartsChildrenUtil.wrapTreeDataToTreeList(list); - List treelist =new ArrayList<>(); - if(StringUtils.isNotBlank(keyWord)){ - this.getTreeByKeyWord(keyWord,listResult,treelist); - }else{ + List treelist = new ArrayList<>(); + if (StringUtils.isNotBlank(keyWord)) { + this.getTreeByKeyWord(keyWord, listResult, treelist); + } else { return listResult; } return treelist; } - /** - * 根据parentId查询部门树 - * @param parentId - * @param ids 前端回显传递 - * @param primaryKey 主键字段(id或者orgCode) - * @param platType syjg试验机构 ywjg业务机构 - * @return - */ - @Override - public List queryTreeListByPid(String parentId,String ids, String primaryKey,String platType) { - Consumer> square = i -> { - if (oConvertUtils.isNotEmpty(ids)) { - if (CommonConstant.DEPART_KEY_ORG_CODE.equals(primaryKey)) { - i.in(SysDepart::getOrgCode, ids.split(SymbolConstant.COMMA)); - } else { - i.in(SysDepart::getId, ids.split(SymbolConstant.COMMA)); - } - } else { - if(oConvertUtils.isEmpty(parentId)){ - i.and(q->q.isNull(true,SysDepart::getParentId).or().eq(true,SysDepart::getParentId,"")); - }else{ - i.eq(true,SysDepart::getParentId,parentId); - } - } - }; - LambdaQueryWrapper lqw=new LambdaQueryWrapper<>(); - //------------------------------------------------------------------------------------------------ - //是否开启系统管理模块的 SASS 控制 - if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){ - lqw.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); - } - //------------------------------------------------------------------------------------------------ - lqw.eq(true,SysDepart::getDelFlag,CommonConstant.DEL_FLAG_0.toString()); - lqw.func(square); + /** + * 根据parentId查询部门树 + * + * @param parentId + * @param ids 前端回显传递 + * @param primaryKey 主键字段(id或者orgCode) + * @param platType syjg试验机构 ywjg业务机构 + * @return + */ + @Override + public List queryTreeListByPid(String parentId, String ids, String primaryKey, String platType) { + Consumer> square = i -> { + if (oConvertUtils.isNotEmpty(ids)) { + if (CommonConstant.DEPART_KEY_ORG_CODE.equals(primaryKey)) { + i.in(SysDepart::getOrgCode, ids.split(SymbolConstant.COMMA)); + } else { + i.in(SysDepart::getId, ids.split(SymbolConstant.COMMA)); + } + } else { + if (oConvertUtils.isEmpty(parentId)) { + i.and(q -> q.isNull(true, SysDepart::getParentId).or().eq(true, SysDepart::getParentId, "")); + } else { + i.eq(true, SysDepart::getParentId, parentId); + } + } + }; + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + //------------------------------------------------------------------------------------------------ + //是否开启系统管理模块的 SASS 控制 + if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { + lqw.eq(SysDepart::getTenantId, oConvertUtils.getInt(TenantContext.getTenant(), 0)); + } + //------------------------------------------------------------------------------------------------ + lqw.eq(true, SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()); + lqw.func(square); //update-begin---author:wangshuai ---date:20220527 for:[VUEN-1143]排序不对,vue3和2应该都有问题,应该按照升序排------------ - lqw.orderByAsc(SysDepart::getDepartOrder); + lqw.orderByAsc(SysDepart::getDepartOrder); //update-end---author:wangshuai ---date:20220527 for:[VUEN-1143]排序不对,vue3和2应该都有问题,应该按照升序排-------------- - //查询试验机构 或 业务机构 - if(StringUtils.isNotBlank(platType)){ - lqw.eq(true,SysDepart::getPlatType,platType); - } - List list = list(lqw); + //查询试验机构 或 业务机构 + if (StringUtils.isNotBlank(platType)) { + lqw.eq(true, SysDepart::getPlatType, platType); + } + List list = list(lqw); //update-begin---author:wangshuai ---date:20220316 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 //设置用户id,让前台显示 this.setUserIdsByDepList(list); //update-end---author:wangshuai ---date:20220316 for:[JTC-119]在部门管理菜单下设置部门负责人 创建用户的时候不需要处理 - List records = new ArrayList<>(); - for (int i = 0; i < list.size(); i++) { - SysDepart depart = list.get(i); + List records = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + SysDepart depart = list.get(i); SysDepartTreeModel treeModel = new SysDepartTreeModel(depart); //TODO 异步树加载key拼接__+时间戳,以便于每次展开节点会刷新数据 - //treeModel.setKey(treeModel.getKey()+"__"+System.currentTimeMillis()); + //treeModel.setKey(treeModel.getKey()+"__"+System.currentTimeMillis()); records.add(treeModel); } - return records; - } + return records; + } - @Override - public JSONObject queryAllParentIdByDepartId(String departId) { - JSONObject result = new JSONObject(); - for (String id : departId.split(SymbolConstant.COMMA)) { - JSONObject all = this.queryAllParentId("id", id); - result.put(id, all); - } - return result; - } + @Override + public JSONObject queryAllParentIdByDepartId(String departId) { + JSONObject result = new JSONObject(); + for (String id : departId.split(SymbolConstant.COMMA)) { + JSONObject all = this.queryAllParentId("id", id); + result.put(id, all); + } + return result; + } - @Override - public JSONObject queryAllParentIdByOrgCode(String orgCode) { - JSONObject result = new JSONObject(); - for (String code : orgCode.split(SymbolConstant.COMMA)) { - JSONObject all = this.queryAllParentId("org_code", code); - result.put(code, all); - } - return result; - } + @Override + public JSONObject queryAllParentIdByOrgCode(String orgCode) { + JSONObject result = new JSONObject(); + for (String code : orgCode.split(SymbolConstant.COMMA)) { + JSONObject all = this.queryAllParentId("org_code", code); + result.put(code, all); + } + return result; + } - /** - * 查询某个部门的所有父ID信息 - * - * @param fieldName 字段名 - * @param value 值 - */ - private JSONObject queryAllParentId(String fieldName, String value) { - JSONObject data = new JSONObject(); - // 父ID集合,有序 - data.put("parentIds", new JSONArray()); - // 父ID的部门数据,key是id,value是数据 - data.put("parentMap", new JSONObject()); - this.queryAllParentIdRecursion(fieldName, value, data); - return data; - } + /** + * 查询某个部门的所有父ID信息 + * + * @param fieldName 字段名 + * @param value 值 + */ + private JSONObject queryAllParentId(String fieldName, String value) { + JSONObject data = new JSONObject(); + // 父ID集合,有序 + data.put("parentIds", new JSONArray()); + // 父ID的部门数据,key是id,value是数据 + data.put("parentMap", new JSONObject()); + this.queryAllParentIdRecursion(fieldName, value, data); + return data; + } - /** - * 递归调用查询父部门接口 - */ - private void queryAllParentIdRecursion(String fieldName, String value, JSONObject data) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq(fieldName, value); - SysDepart depart = super.getOne(queryWrapper); - if (depart != null) { - data.getJSONArray("parentIds").add(0, depart.getId()); - data.getJSONObject("parentMap").put(depart.getId(), depart); - if (oConvertUtils.isNotEmpty(depart.getParentId())) { - this.queryAllParentIdRecursion("id", depart.getParentId(), data); - } - } - } + /** + * 递归调用查询父部门接口 + */ + private void queryAllParentIdRecursion(String fieldName, String value, JSONObject data) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(fieldName, value); + SysDepart depart = super.getOne(queryWrapper); + if (depart != null) { + data.getJSONArray("parentIds").add(0, depart.getId()); + data.getJSONObject("parentMap").put(depart.getId(), depart); + if (oConvertUtils.isNotEmpty(depart.getParentId())) { + this.queryAllParentIdRecursion("id", depart.getParentId(), data); + } + } + } - @Override - public SysDepart queryCompByOrgCode(String orgCode) { - int length = YouBianCodeUtil.ZHANWEI_LENGTH; - String compyOrgCode = orgCode.substring(0,length); - return this.baseMapper.queryCompByOrgCode(compyOrgCode); - } - /** - * 根据id查询下级部门 - * @param pid - * @return - */ - @Override - public List queryDeptByPid(String pid) { - return this.baseMapper.queryDeptByPid(pid); - } - /** + @Override + public SysDepart queryCompByOrgCode(String orgCode) { + int length = YouBianCodeUtil.ZHANWEI_LENGTH; + String compyOrgCode = orgCode.substring(0, length); + return this.baseMapper.queryCompByOrgCode(compyOrgCode); + } + + /** + * 根据id查询下级部门 + * + * @param pid + * @return + */ + @Override + public List queryDeptByPid(String pid) { + return this.baseMapper.queryDeptByPid(pid); + } + + /** * 根据关键字筛选部门信息 + * * @param keyWord * @return */ - public void getTreeByKeyWord(String keyWord,List allResult,List newResult){ - for (SysDepartTreeModel model:allResult) { - if (model.getDepartName().contains(keyWord)){ + public void getTreeByKeyWord(String keyWord, List allResult, List newResult) { + for (SysDepartTreeModel model : allResult) { + if (model.getDepartName().contains(keyWord)) { newResult.add(model); continue; - }else if(model.getChildren()!=null){ - getTreeByKeyWord(keyWord,model.getChildren(),newResult); + } else if (model.getChildren() != null) { + getTreeByKeyWord(keyWord, model.getChildren(), newResult); } } } //update-begin---author:wangshuai ---date:20200308 for:[JTC-119]在部门管理菜单下设置部门负责人,新增方法添加部门负责人、删除负责部门负责人、查询部门对应的负责人 + /** * 通过用户id设置负责部门 + * * @param sysDepart SysDepart部门对象 - * @param userIds 多个负责用户id + * @param userIds 多个负责用户id */ public void addDepartByUserIds(SysDepart sysDepart, String userIds) { //获取部门id,保存到用户 String departId = sysDepart.getId(); //循环用户id String[] userIdArray = userIds.split(","); - for (String userId:userIdArray) { + for (String userId : userIdArray) { //查询用户表增加负责部门 SysUser sysUser = sysUserMapper.selectById(userId); //如果部门id不为空,那么就需要拼接 - if(oConvertUtils.isNotEmpty(sysUser.getDepartIds())){ - if(!sysUser.getDepartIds().contains(departId)) { + if (oConvertUtils.isNotEmpty(sysUser.getDepartIds())) { + if (!sysUser.getDepartIds().contains(departId)) { sysUser.setDepartIds(sysUser.getDepartIds() + "," + departId); } - }else{ + } else { sysUser.setDepartIds(departId); } //设置身份为上级 @@ -762,14 +778,15 @@ public class SysDepartServiceImpl extends ServiceImpl userDepartList = userDepartMapper.getUserDepartByUid(userId); boolean isExistDepId = userDepartList.stream().anyMatch(item -> departId.equals(item.getDepId())); //如果不存在需要设置所属部门 - if(!isExistDepId){ - userDepartMapper.insert(new SysUserDepart(userId,departId)); + if (!isExistDepId) { + userDepartMapper.insert(new SysUserDepart(userId, departId)); } } } /** * 修改用户负责部门 + * * @param sysDepart SysDepart对象 */ private void updateChargeDepart(SysDepart sysDepart) { @@ -779,47 +796,48 @@ public class SysDepartServiceImpl extends ServiceImpl userIdList = Arrays.stream(oldDirectorIds.split(",")).filter(item -> !directorIds.contains(item)).collect(Collectors.toList()); - for (String userId:userIdList){ - this.deleteChargeDepId(departId,userId); + for (String userId : userIdList) { + this.deleteChargeDepId(departId, userId); } //找到原来负责部门的用户id与新的负责部门用户id,进行新增 String addUserIds = Arrays.stream(directorIds.split(",")).filter(item -> !oldDirectorIds.contains(item)).collect(Collectors.joining(",")); - if(oConvertUtils.isNotEmpty(addUserIds)){ - this.addDepartByUserIds(sysDepart,addUserIds); + if (oConvertUtils.isNotEmpty(addUserIds)) { + this.addDepartByUserIds(sysDepart, addUserIds); } } } /** * 删除用户负责部门 + * * @param departId 部门id - * @param userId 用户id + * @param userId 用户id */ - private void deleteChargeDepId(String departId,String userId){ + private void deleteChargeDepId(String departId, String userId) { //先查询负责部门的用户id,因为负责部门的id使用逗号拼接起来的 LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.like(SysUser::getDepartIds,departId); + query.like(SysUser::getDepartIds, departId); //删除全部的情况下用户id不存在 - if(oConvertUtils.isNotEmpty(userId)){ - query.eq(SysUser::getId,userId); + if (oConvertUtils.isNotEmpty(userId)) { + query.eq(SysUser::getId, userId); } List userList = sysUserMapper.selectList(query); - for (SysUser sysUser:userList) { + for (SysUser sysUser : userList) { //将不存在的部门id删除掉 String departIds = sysUser.getDepartIds(); List list = new ArrayList<>(Arrays.asList(departIds.split(","))); list.remove(departId); //删除之后再将新的id用逗号拼接起来进行更新 - String newDepartIds = String.join(",",list); + String newDepartIds = String.join(",", list); sysUser.setDepartIds(newDepartIds); sysUserMapper.updateById(sysUser); } @@ -827,31 +845,32 @@ public class SysDepartServiceImpl extends ServiceImpl departList) { //查询负责部门不为空的情况 - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); query.isNotNull(SysUser::getDepartIds); List users = sysUserMapper.selectList(query); - Map map = new HashMap(5); + Map map = new HashMap(5); //先循环一遍找到不同的负责部门id - for (SysUser user:users) { + for (SysUser user : users) { String departIds = user.getDepartIds(); String[] departIdArray = departIds.split(","); - for (String departId:departIdArray) { + for (String departId : departIdArray) { //mao中包含部门key,负责用户直接拼接 - if(map.containsKey(departId)){ + if (map.containsKey(departId)) { String userIds = map.get(departId) + "," + user.getId(); - map.put(departId,userIds); - }else{ - map.put(departId,user.getId()); + map.put(departId, userIds); + } else { + map.put(departId, user.getId()); } } } //循环部门集合找到部门id对应的负责用户 - for (SysDepart sysDepart:departList) { - if(map.containsKey(sysDepart.getId())){ + for (SysDepart sysDepart : departList) { + if (map.containsKey(sysDepart.getId())) { sysDepart.setDirectorUserIds(map.get(sysDepart.getId()).toString()); } } @@ -860,6 +879,7 @@ public class SysDepartServiceImpl extends ServiceImpl query = new LambdaQueryWrapper() - .eq(SysUserDepart::getDepId, id); - this.userDepartMapper.delete(query); - } + @Override + public void deleteDepart(String id) { + //删除部门设置父级的叶子结点 + this.setIzLeaf(id); + this.delete(id); + //删除部门用户关系表 + LambdaQueryWrapper query = new LambdaQueryWrapper() + .eq(SysUserDepart::getDepId, id); + this.userDepartMapper.delete(query); + } - @Override - public List queryBookDepTreeSync(String parentId, Integer tenantId, String departName) { - List list = departMapper.queryBookDepTreeSync(parentId,tenantId,departName); - List records = new ArrayList<>(); - for (int i = 0; i < list.size(); i++) { - SysDepart depart = list.get(i); - SysDepartTreeModel treeModel = new SysDepartTreeModel(depart); - records.add(treeModel); - } - return records; - } + @Override + public List queryBookDepTreeSync(String parentId, Integer tenantId, String departName) { + List list = departMapper.queryBookDepTreeSync(parentId, tenantId, departName); + List records = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + SysDepart depart = list.get(i); + SysDepartTreeModel treeModel = new SysDepartTreeModel(depart); + records.add(treeModel); + } + return records; + } - @Override - public SysDepart getDepartById(String id) { - return departMapper.getDepartById(id); - } + @Override + public SysDepart getDepartById(String id) { + return departMapper.getDepartById(id); + } - @Override - public IPage getMaxCodeDepart(Page page, String parentId) { - return page.setRecords(departMapper.getMaxCodeDepart(page,parentId)); - } + @Override + public IPage getMaxCodeDepart(Page page, String parentId) { + return page.setRecords(departMapper.getMaxCodeDepart(page, parentId)); + } - @Override - public void updateIzLeaf(String id, Integer izLeaf) { - departMapper.setMainLeaf(id,izLeaf); - } + @Override + public void updateIzLeaf(String id, Integer izLeaf) { + departMapper.setMainLeaf(id, izLeaf); + } - /** - * 设置父级节点是否存在叶子结点 - * @param id - */ - private void setIzLeaf(String id) { - SysDepart depart = this.getDepartById(id); - String parentId = depart.getParentId(); - if(oConvertUtils.isNotEmpty(parentId)){ - Long count = this.count(new QueryWrapper().lambda().eq(SysDepart::getParentId, parentId)); - if(count == 1){ - //若父节点无其他子节点,则该父节点是叶子节点 - departMapper.setMainLeaf(parentId, CommonConstant.IS_LEAF); - } - } - } + /** + * 设置父级节点是否存在叶子结点 + * + * @param id + */ + private void setIzLeaf(String id) { + SysDepart depart = this.getDepartById(id); + String parentId = depart.getParentId(); + if (oConvertUtils.isNotEmpty(parentId)) { + Long count = this.count(new QueryWrapper().lambda().eq(SysDepart::getParentId, parentId)); + if (count == 1) { + //若父节点无其他子节点,则该父节点是叶子节点 + departMapper.setMainLeaf(parentId, CommonConstant.IS_LEAF); + } + } + } - //========================begin 零代码下部门与人员导出 ================================================================== + //========================begin 零代码下部门与人员导出 ================================================================== - @Override - public List getExcelDepart(int tenantId) { - //获取父级部门 - List parentDepart = departMapper.getDepartList("",tenantId); - //子部门 - List childrenDepart = new ArrayList<>(); - //把一级部门名称放在里面 - List exportDepartVoList = new ArrayList<>(); - //存放部门一级id避免重复 - List departIdList = new ArrayList<>(); - for (ExportDepartVo departVo:parentDepart) { - departIdList.add(departVo.getId()); - departVo.setDepartNameUrl(departVo.getDepartName()); - exportDepartVoList.add(departVo); - //创建路径 - List path = new ArrayList<>(); - path.add(departVo.getDepartName()); - //创建子部门路径 - findPath(departVo, path, tenantId,childrenDepart,departIdList); - path.clear(); - } - exportDepartVoList.addAll(childrenDepart); - childrenDepart.clear(); - departIdList.clear(); - return exportDepartVoList; - } + @Override + public List getExcelDepart(int tenantId) { + //获取父级部门 + List parentDepart = departMapper.getDepartList("", tenantId); + //子部门 + List childrenDepart = new ArrayList<>(); + //把一级部门名称放在里面 + List exportDepartVoList = new ArrayList<>(); + //存放部门一级id避免重复 + List departIdList = new ArrayList<>(); + for (ExportDepartVo departVo : parentDepart) { + departIdList.add(departVo.getId()); + departVo.setDepartNameUrl(departVo.getDepartName()); + exportDepartVoList.add(departVo); + //创建路径 + List path = new ArrayList<>(); + path.add(departVo.getDepartName()); + //创建子部门路径 + findPath(departVo, path, tenantId, childrenDepart, departIdList); + path.clear(); + } + exportDepartVoList.addAll(childrenDepart); + childrenDepart.clear(); + departIdList.clear(); + return exportDepartVoList; + } - /** - * 寻找部门路径 - * @param departVo 部门vo - * @param path 部门路径 - * @param tenantId 租户id - * @param childrenDepart 子部门 - * @param departIdList 部门id集合 - */ - private void findPath(ExportDepartVo departVo, List path,Integer tenantId,List childrenDepart,List departIdList) { - //获取租户id和部门父id获取的部门数据 - List departList = departMapper.getDepartList(departVo.getId(), tenantId); - //部门为空判断 - if (departList == null || departList.size() <= 0) { - if(!departIdList.contains(departVo.getId())){ - departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH,path)); - childrenDepart.add(departVo); - } - return; - } + /** + * 寻找部门路径 + * + * @param departVo 部门vo + * @param path 部门路径 + * @param tenantId 租户id + * @param childrenDepart 子部门 + * @param departIdList 部门id集合 + */ + private void findPath(ExportDepartVo departVo, List path, Integer tenantId, List childrenDepart, List departIdList) { + //获取租户id和部门父id获取的部门数据 + List departList = departMapper.getDepartList(departVo.getId(), tenantId); + //部门为空判断 + if (departList == null || departList.size() <= 0) { + if (!departIdList.contains(departVo.getId())) { + departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH, path)); + childrenDepart.add(departVo); + } + return; + } - for (int i = 0; i < departList.size(); i++) { - ExportDepartVo exportDepartVo = departList.get(i); - //存放子级路径 - List cPath = new ArrayList<>(); - cPath.addAll(path); - cPath.add(exportDepartVo.getDepartName()); - if(!departIdList.contains(departVo.getId())){ - departIdList.add(departVo.getId()); - departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH,path)); - childrenDepart.add(departVo); - } - findPath(exportDepartVo,cPath ,tenantId, childrenDepart,departIdList); - } - } - //========================end 零代码下部门与人员导出 ================================================================== + for (int i = 0; i < departList.size(); i++) { + ExportDepartVo exportDepartVo = departList.get(i); + //存放子级路径 + List cPath = new ArrayList<>(); + cPath.addAll(path); + cPath.add(exportDepartVo.getDepartName()); + if (!departIdList.contains(departVo.getId())) { + departIdList.add(departVo.getId()); + departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH, path)); + childrenDepart.add(departVo); + } + findPath(exportDepartVo, cPath, tenantId, childrenDepart, departIdList); + } + } + //========================end 零代码下部门与人员导出 ================================================================== - //========================begin 零代码下部门与人员导入 ================================================================== - @Override - public void importExcel(List listSysDeparts, List errorMessageList) { - int num = 0; - int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); + //========================begin 零代码下部门与人员导入 ================================================================== + @Override + public void importExcel(List listSysDeparts, List errorMessageList) { + int num = 0; + int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); - //部门路径排序 - Collections.sort(listSysDeparts, new Comparator() { - @Override - public int compare(ExportDepartVo o1, ExportDepartVo o2) { - if(oConvertUtils.isNotEmpty(o1.getDepartNameUrl()) && oConvertUtils.isNotEmpty(o2.getDepartNameUrl())){ - int oldLength = o1.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length; - int newLength = o2.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length; - return oldLength - newLength; - }else{ - return 0; - } - } - }); - //存放部门数据的map - Map departMap = new HashMap<>(); - //循环第二遍导入数据 - for (ExportDepartVo exportDepartVo : listSysDeparts) { - SysDepart sysDepart = new SysDepart(); - // orgCode编码长度 - int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH; - Boolean izExport = false; - try { - izExport = this.addDepartByName(exportDepartVo.getDepartNameUrl(),exportDepartVo.getDepartName(),sysDepart,errorMessageList,tenantId,departMap,num); - } catch (Exception e) { - //没有查找到parentDept - } - //没有错误的时候才会导入数据 - if(izExport){ - sysDepart.setOrgType(sysDepart.getOrgCode().length()/codeLength+""); - sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); - sysDepart.setOrgCategory("1"); - sysDepart.setTenantId(tenantId); - ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE); - departMap.put(exportDepartVo.getDepartNameUrl(),sysDepart); - } - num++; - } - } + //部门路径排序 + Collections.sort(listSysDeparts, new Comparator() { + @Override + public int compare(ExportDepartVo o1, ExportDepartVo o2) { + if (oConvertUtils.isNotEmpty(o1.getDepartNameUrl()) && oConvertUtils.isNotEmpty(o2.getDepartNameUrl())) { + int oldLength = o1.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length; + int newLength = o2.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length; + return oldLength - newLength; + } else { + return 0; + } + } + }); + //存放部门数据的map + Map departMap = new HashMap<>(); + //循环第二遍导入数据 + for (ExportDepartVo exportDepartVo : listSysDeparts) { + SysDepart sysDepart = new SysDepart(); + // orgCode编码长度 + int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH; + Boolean izExport = false; + try { + izExport = this.addDepartByName(exportDepartVo.getDepartNameUrl(), exportDepartVo.getDepartName(), sysDepart, errorMessageList, tenantId, departMap, num); + } catch (Exception e) { + //没有查找到parentDept + } + //没有错误的时候才会导入数据 + if (izExport) { + sysDepart.setOrgType(sysDepart.getOrgCode().length() / codeLength + ""); + sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); + sysDepart.setOrgCategory("1"); + sysDepart.setTenantId(tenantId); + ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE); + departMap.put(exportDepartVo.getDepartNameUrl(), sysDepart); + } + num++; + } + } - /** - * 添加部门 - * @param departNameUrl 部门路径 - * @param departName 部门名称 - * @param sysDepart 部门类 - * @param errorMessageList 错误集合 - * @param tenantId 租户id - * @param departMap 部门数组。避免存在部门信息再次查询 key 存放部门路径 value 存放部门对象 - * @param num 判断第几行有错误信息 - */ - private Boolean addDepartByName(String departNameUrl,String departName,SysDepart sysDepart,List errorMessageList,Integer tenantId,Map departMap, int num) { - int lineNumber = num + 1; - if(oConvertUtils.isEmpty(departNameUrl) && oConvertUtils.isEmpty(departName)){ - //部门路径为空 - errorMessageList.add("第 " + lineNumber + " 行:记录部门路径或者部门名称为空禁止导入"); - return false; - } - //获取部门名称路径 - String name = ""; - if(departNameUrl.contains(SymbolConstant.SINGLE_SLASH)){ - //获取分割的部门名称 - name = departNameUrl.substring(departNameUrl.lastIndexOf(SymbolConstant.SINGLE_SLASH)+1); - }else{ - name = departNameUrl; - } + /** + * 添加部门 + * + * @param departNameUrl 部门路径 + * @param departName 部门名称 + * @param sysDepart 部门类 + * @param errorMessageList 错误集合 + * @param tenantId 租户id + * @param departMap 部门数组。避免存在部门信息再次查询 key 存放部门路径 value 存放部门对象 + * @param num 判断第几行有错误信息 + */ + private Boolean addDepartByName(String departNameUrl, String departName, SysDepart sysDepart, List errorMessageList, Integer tenantId, Map departMap, int num) { + int lineNumber = num + 1; + if (oConvertUtils.isEmpty(departNameUrl) && oConvertUtils.isEmpty(departName)) { + //部门路径为空 + errorMessageList.add("第 " + lineNumber + " 行:记录部门路径或者部门名称为空禁止导入"); + return false; + } + //获取部门名称路径 + String name = ""; + if (departNameUrl.contains(SymbolConstant.SINGLE_SLASH)) { + //获取分割的部门名称 + name = departNameUrl.substring(departNameUrl.lastIndexOf(SymbolConstant.SINGLE_SLASH) + 1); + } else { + name = departNameUrl; + } - if(!name.equals(departName)){ - //部门名称已存在 - errorMessageList.add("第 " + lineNumber + " 行:记录部门路径:”"+departNameUrl+"“"+"和部门名称:“"+departName+"“不一致,请检查!"); - return false; - }else{ - String parentId = ""; - //判断是否包含“/” - if(departNameUrl.contains(SymbolConstant.SINGLE_SLASH)){ - //获取最后一个斜杠之前的路径 - String departNames = departNameUrl.substring(0,departNameUrl.lastIndexOf(SymbolConstant.SINGLE_SLASH)); - //判断是否已经包含部门路径 - if(departMap.containsKey(departNames)){ - SysDepart depart = departMap.get(departNames); - if(null != depart){ - parentId = depart.getId(); - } - }else{ - //分割斜杠路径,查看数据库中是否存在此路径 - String[] departNameUrls = departNameUrl.split(SymbolConstant.SINGLE_SLASH); - String departUrlName = departNameUrls[0]; - //判断是否为最后一位 - int count = 0; - SysDepart depart = new SysDepart(); - depart.setId(""); - String parentIdByName = this.getDepartListByName(departUrlName,tenantId,depart,departNameUrls,count,departNameUrls.length-1,name,departMap); - //如果parentId不为空 - if(oConvertUtils.isNotEmpty(parentIdByName)){ - parentId = parentIdByName; - }else{ - //部门名称已存在 - errorMessageList.add("第 " + lineNumber + " 行:记录部门名称“"+departName+"”上级不存在,请检查!"); - return false; - } - } - } - //查询部门名称是否已存在 - SysDepart parentDept = null; - //update-begin---author:wangshuai ---date:20230721 for:一个租户部门名称可能有多个------------ - List sysDepartList = departMapper.getDepartByName(departName,tenantId,parentId); - if(CollectionUtil.isNotEmpty(sysDepartList)){ - parentDept = sysDepartList.get(0); - } - //update-end---author:wangshuai ---date:20230721 for:一个租户部门名称可能有多个------------ - if(null != parentDept) { - //部门名称已存在 - errorMessageList.add("第 " + lineNumber + " 行:记录部门名称“"+departName+"”已存在,请检查!"); - return false; - }else{ - Page page = new Page<>(1,1); - //需要获取父级id,查看父级是否已经存在 - //获取一级部门的最大orgCode - List records = departMapper.getMaxCodeDepart(page, parentId); - String newOrgCode = ""; - if(CollectionUtil.isNotEmpty(records)){ - newOrgCode = YouBianCodeUtil.getNextYouBianCode(records.get(0).getOrgCode()); - }else{ - //查询父id - if(oConvertUtils.isNotEmpty(parentId)){ - SysDepart departById = departMapper.getDepartById(parentId); - newOrgCode = YouBianCodeUtil.getSubYouBianCode(departById.getOrgCode(), null); - }else{ - newOrgCode = YouBianCodeUtil.getNextYouBianCode(null); - } - } - if(oConvertUtils.isNotEmpty(parentId)){ - this.updateIzLeaf(parentId,CommonConstant.NOT_LEAF); - sysDepart.setParentId(parentId); - } - sysDepart.setOrgCode(newOrgCode); - sysDepart.setDepartName(departName); - return true; - } + if (!name.equals(departName)) { + //部门名称已存在 + errorMessageList.add("第 " + lineNumber + " 行:记录部门路径:”" + departNameUrl + "“" + "和部门名称:“" + departName + "“不一致,请检查!"); + return false; + } else { + String parentId = ""; + //判断是否包含“/” + if (departNameUrl.contains(SymbolConstant.SINGLE_SLASH)) { + //获取最后一个斜杠之前的路径 + String departNames = departNameUrl.substring(0, departNameUrl.lastIndexOf(SymbolConstant.SINGLE_SLASH)); + //判断是否已经包含部门路径 + if (departMap.containsKey(departNames)) { + SysDepart depart = departMap.get(departNames); + if (null != depart) { + parentId = depart.getId(); + } + } else { + //分割斜杠路径,查看数据库中是否存在此路径 + String[] departNameUrls = departNameUrl.split(SymbolConstant.SINGLE_SLASH); + String departUrlName = departNameUrls[0]; + //判断是否为最后一位 + int count = 0; + SysDepart depart = new SysDepart(); + depart.setId(""); + String parentIdByName = this.getDepartListByName(departUrlName, tenantId, depart, departNameUrls, count, departNameUrls.length - 1, name, departMap); + //如果parentId不为空 + if (oConvertUtils.isNotEmpty(parentIdByName)) { + parentId = parentIdByName; + } else { + //部门名称已存在 + errorMessageList.add("第 " + lineNumber + " 行:记录部门名称“" + departName + "”上级不存在,请检查!"); + return false; + } + } + } + //查询部门名称是否已存在 + SysDepart parentDept = null; + //update-begin---author:wangshuai ---date:20230721 for:一个租户部门名称可能有多个------------ + List sysDepartList = departMapper.getDepartByName(departName, tenantId, parentId); + if (CollectionUtil.isNotEmpty(sysDepartList)) { + parentDept = sysDepartList.get(0); + } + //update-end---author:wangshuai ---date:20230721 for:一个租户部门名称可能有多个------------ + if (null != parentDept) { + //部门名称已存在 + errorMessageList.add("第 " + lineNumber + " 行:记录部门名称“" + departName + "”已存在,请检查!"); + return false; + } else { + Page page = new Page<>(1, 1); + //需要获取父级id,查看父级是否已经存在 + //获取一级部门的最大orgCode + List records = departMapper.getMaxCodeDepart(page, parentId); + String newOrgCode = ""; + if (CollectionUtil.isNotEmpty(records)) { + newOrgCode = YouBianCodeUtil.getNextYouBianCode(records.get(0).getOrgCode()); + } else { + //查询父id + if (oConvertUtils.isNotEmpty(parentId)) { + SysDepart departById = departMapper.getDepartById(parentId); + newOrgCode = YouBianCodeUtil.getSubYouBianCode(departById.getOrgCode(), null); + } else { + newOrgCode = YouBianCodeUtil.getNextYouBianCode(null); + } + } + if (oConvertUtils.isNotEmpty(parentId)) { + this.updateIzLeaf(parentId, CommonConstant.NOT_LEAF); + sysDepart.setParentId(parentId); + } + sysDepart.setOrgCode(newOrgCode); + sysDepart.setDepartName(departName); + return true; + } - } - } + } + } - /** - * 获取部门名称url(下级) - * @param departName 部门名称 - * @param tenantId 租户id - * @param sysDepart 部门对象 - * @param count 部门路径下标 - * @param departNameUrls 部门路径 - * @param departNum 部门路径的数量 - * @param name 部门路径的数量 - * @param departMap 存放部门的数据 key 存放部门路径 value 存放部门对象 - */ - private String getDepartListByName(String departName, Integer tenantId, SysDepart sysDepart,String[] departNameUrls, int count, int departNum,String name,Map departMap) { - //递归查找下一级 - //update-begin---author:wangshuai ---date:20230721 for:一个租户部门名称可能有多个------------ - SysDepart parentDept = null; - List departList = departMapper.getDepartByName(departName,tenantId,sysDepart.getId()); - if(CollectionUtil.isNotEmpty(departList)){ - parentDept = departList.get(0); - } - //update-end---author:wangshuai ---date:20230721 for:一个租户部门名称可能有多个------------ - //判断是否包含/ - if(oConvertUtils.isNotEmpty(name)){ - name = name + SymbolConstant.SINGLE_SLASH + departName; - }else{ - name = departName; - } - if(null != parentDept){ - //如果名称路径key不再在,添加一个,避免再次查询 - if(!departMap.containsKey(name)){ - departMap.put(name,parentDept); - } - //查询出来的部门名称和部门路径中的部门名称作比较,如果不存在直接返回空 - if(parentDept.getDepartName().equals(departNameUrls[count])){ - count = count + 1; - //数量和部门数量相等说明已经到最后一位了,直接返回部门id - if(count == departNum){ - return parentDept.getId(); - }else{ - return this.getDepartListByName(departNameUrls[count],tenantId,parentDept,departNameUrls,count,departNum,name,departMap); - } - }else{ - return ""; - } - }else{ - return ""; - } - } - //========================end 零代码下部门与人员导入 ================================================================== + /** + * 获取部门名称url(下级) + * + * @param departName 部门名称 + * @param tenantId 租户id + * @param sysDepart 部门对象 + * @param count 部门路径下标 + * @param departNameUrls 部门路径 + * @param departNum 部门路径的数量 + * @param name 部门路径的数量 + * @param departMap 存放部门的数据 key 存放部门路径 value 存放部门对象 + */ + private String getDepartListByName(String departName, Integer tenantId, SysDepart sysDepart, String[] departNameUrls, int count, int departNum, String name, Map departMap) { + //递归查找下一级 + //update-begin---author:wangshuai ---date:20230721 for:一个租户部门名称可能有多个------------ + SysDepart parentDept = null; + List departList = departMapper.getDepartByName(departName, tenantId, sysDepart.getId()); + if (CollectionUtil.isNotEmpty(departList)) { + parentDept = departList.get(0); + } + //update-end---author:wangshuai ---date:20230721 for:一个租户部门名称可能有多个------------ + //判断是否包含/ + if (oConvertUtils.isNotEmpty(name)) { + name = name + SymbolConstant.SINGLE_SLASH + departName; + } else { + name = departName; + } + if (null != parentDept) { + //如果名称路径key不再在,添加一个,避免再次查询 + if (!departMap.containsKey(name)) { + departMap.put(name, parentDept); + } + //查询出来的部门名称和部门路径中的部门名称作比较,如果不存在直接返回空 + if (parentDept.getDepartName().equals(departNameUrls[count])) { + count = count + 1; + //数量和部门数量相等说明已经到最后一位了,直接返回部门id + if (count == departNum) { + return parentDept.getId(); + } else { + return this.getDepartListByName(departNameUrls[count], tenantId, parentDept, departNameUrls, count, departNum, name, departMap); + } + } else { + return ""; + } + } else { + return ""; + } + } + //========================end 零代码下部门与人员导入 ================================================================== - /** - * 清空部门id - * - * @param parentIdList - */ - private void setParentDepartIzLeaf(List parentIdList) { - if (CollectionUtil.isNotEmpty(parentIdList)) { - for (String parentId : parentIdList) { - //查询父级id没有子级的时候跟新为叶子节点 - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(SysDepart::getParentId, parentId); - Long count = departMapper.selectCount(query); - //当子级都不存在时,设置当前部门为叶子节点 - if (count == 0) { - departMapper.setMainLeaf(parentId, CommonConstant.IS_LEAF); - } - } - } - } + /** + * 清空部门id + * + * @param parentIdList + */ + private void setParentDepartIzLeaf(List parentIdList) { + if (CollectionUtil.isNotEmpty(parentIdList)) { + for (String parentId : parentIdList) { + //查询父级id没有子级的时候跟新为叶子节点 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(SysDepart::getParentId, parentId); + Long count = departMapper.selectCount(query); + //当子级都不存在时,设置当前部门为叶子节点 + if (count == 0) { + departMapper.setMainLeaf(parentId, CommonConstant.IS_LEAF); + } + } + } + } - //========================begin 系统下部门与人员导入 ================================================================== - /** - * 系统部门导出 - * @param tenantId - * @param idList 需要查询部门sql的id集合 - * @return - */ - @Override - public List getExportDepart(Integer tenantId, List idList) { - //获取父级部门 - List parentDepart = departMapper.getSysDepartList("", tenantId, idList); - //子部门 - List childrenDepart = new ArrayList<>(); - //把一级部门名称放在里面 - List exportDepartVoList = new ArrayList<>(); - //存放部门一级id避免重复 - List departIdList = new ArrayList<>(); - for (SysDepartExportVo sysDepart : parentDepart) { - //step 1.添加第一级部门 - departIdList.add(sysDepart.getId()); - sysDepart.setDepartNameUrl(sysDepart.getDepartName()); - exportDepartVoList.add(sysDepart); - //step 2.添加自己部门路径,用/分离 - //创建路径 - List path = new ArrayList<>(); - path.add(sysDepart.getDepartName()); - //创建子部门路径 - findSysDepartPath(sysDepart, path, tenantId, childrenDepart, departIdList, idList); - path.clear(); - } - exportDepartVoList.addAll(childrenDepart); - childrenDepart.clear(); - departIdList.clear(); - return exportDepartVoList; - } + //========================begin 系统下部门与人员导入 ================================================================== - /** - * 系统部门导入 - * @param listSysDeparts - * @param errorMessageList - */ - @Override - public void importSysDepart(List listSysDeparts, List errorMessageList) { - int num = 0; - int tenantId = 0; - if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { - tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); - } - //部门路径排序 - Collections.sort(listSysDeparts, new Comparator() { - @Override - public int compare(SysDepartExportVo o1, SysDepartExportVo o2) { - if(oConvertUtils.isNotEmpty(o1.getDepartNameUrl()) && oConvertUtils.isNotEmpty(o2.getDepartNameUrl())){ - int oldLength = o1.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length; - int newLength = o2.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length; - return oldLength - newLength; - }else{ - return 0; - } - } - }); - //存放部门数据的map - Map departMap = new HashMap<>(); - // orgCode编码长度 - int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH; - //循环第二遍导入数据 - for (SysDepartExportVo departExportVo : listSysDeparts) { - SysDepart sysDepart = new SysDepart(); - boolean izExport = false; - try { - izExport = this.addDepartByName(departExportVo.getDepartNameUrl(),departExportVo.getDepartName(),sysDepart,errorMessageList,tenantId,departMap,num); - } catch (Exception e) { - //没有查找到parentDept - } - //没有错误的时候才会导入数据 - if(izExport){ - if(oConvertUtils.isNotEmpty(departExportVo.getOrgCode())){ - SysDepart depart = this.baseMapper.queryCompByOrgCode(departExportVo.getOrgCode()); - if(null != depart){ - if(oConvertUtils.isNotEmpty(sysDepart.getParentId())){ - //更新上级部门为叶子节点 - this.updateIzLeaf(sysDepart.getParentId(),CommonConstant.IS_LEAF); - } - //部门名称已存在 - errorMessageList.add("第 " + num + " 行:记录部门名称“"+departExportVo.getDepartName()+"”部门编码重复,请检查!"); - continue; - } - String departNameUrl = departExportVo.getDepartNameUrl(); - //包含/说明是多级 - if(departNameUrl.contains(SymbolConstant.SINGLE_SLASH)){ - //判断添加部门的规则是否和生成的一致 - if(!sysDepart.getOrgCode().equals(departExportVo.getOrgCode())){ - if(oConvertUtils.isNotEmpty(sysDepart.getParentId())){ - //更新上级部门为叶子节点 - this.updateIzLeaf(sysDepart.getParentId(),CommonConstant.IS_LEAF); - } - //部门名称已存在 - errorMessageList.add("第 " + num + " 行:记录部门名称“"+departExportVo.getDepartName()+"”部门编码规则不匹配,请检查!"); - continue; - } - } - sysDepart.setOrgCode(departExportVo.getOrgCode()); - if(oConvertUtils.isNotEmpty(sysDepart.getParentId())){ - //上级 - sysDepart.setOrgType("2"); - }else{ - //下级 - sysDepart.setOrgType("1"); - } - }else{ - sysDepart.setOrgType(sysDepart.getOrgCode().length()/codeLength+""); - } - sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); - sysDepart.setDepartNameEn(departExportVo.getDepartNameEn()); - sysDepart.setDepartOrder(departExportVo.getDepartOrder()); - sysDepart.setOrgCategory(oConvertUtils.getString(departExportVo.getOrgCategory(),"1")); - sysDepart.setMobile(departExportVo.getMobile()); - sysDepart.setFax(departExportVo.getFax()); - sysDepart.setAddress(departExportVo.getAddress()); - sysDepart.setMemo(departExportVo.getMemo()); - ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE); - departMap.put(departExportVo.getDepartNameUrl(),sysDepart); - } - num++; - } - } + /** + * 系统部门导出 + * + * @param tenantId + * @param idList 需要查询部门sql的id集合 + * @return + */ + @Override + public List getExportDepart(Integer tenantId, List idList) { + //获取父级部门 + List parentDepart = departMapper.getSysDepartList("", tenantId, idList); + //子部门 + List childrenDepart = new ArrayList<>(); + //把一级部门名称放在里面 + List exportDepartVoList = new ArrayList<>(); + //存放部门一级id避免重复 + List departIdList = new ArrayList<>(); + for (SysDepartExportVo sysDepart : parentDepart) { + //step 1.添加第一级部门 + departIdList.add(sysDepart.getId()); + sysDepart.setDepartNameUrl(sysDepart.getDepartName()); + exportDepartVoList.add(sysDepart); + //step 2.添加自己部门路径,用/分离 + //创建路径 + List path = new ArrayList<>(); + path.add(sysDepart.getDepartName()); + //创建子部门路径 + findSysDepartPath(sysDepart, path, tenantId, childrenDepart, departIdList, idList); + path.clear(); + } + exportDepartVoList.addAll(childrenDepart); + childrenDepart.clear(); + departIdList.clear(); + return exportDepartVoList; + } - @Override - public void changeDirectiveMain(String orgCode) { - SysDepart sysDepart = new SysDepart(); + /** + * 系统部门导入 + * + * @param listSysDeparts + * @param errorMessageList + */ + @Override + public void importSysDepart(List listSysDeparts, List errorMessageList) { + int num = 0; + int tenantId = 0; + if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) { + tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0); + } + //部门路径排序 + Collections.sort(listSysDeparts, new Comparator() { + @Override + public int compare(SysDepartExportVo o1, SysDepartExportVo o2) { + if (oConvertUtils.isNotEmpty(o1.getDepartNameUrl()) && oConvertUtils.isNotEmpty(o2.getDepartNameUrl())) { + int oldLength = o1.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length; + int newLength = o2.getDepartNameUrl().split(SymbolConstant.SINGLE_SLASH).length; + return oldLength - newLength; + } else { + return 0; + } + } + }); + //存放部门数据的map + Map departMap = new HashMap<>(); + // orgCode编码长度 + int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH; + //循环第二遍导入数据 + for (SysDepartExportVo departExportVo : listSysDeparts) { + SysDepart sysDepart = new SysDepart(); + boolean izExport = false; + try { + izExport = this.addDepartByName(departExportVo.getDepartNameUrl(), departExportVo.getDepartName(), sysDepart, errorMessageList, tenantId, departMap, num); + } catch (Exception e) { + //没有查找到parentDept + } + //没有错误的时候才会导入数据 + if (izExport) { + if (oConvertUtils.isNotEmpty(departExportVo.getOrgCode())) { + SysDepart depart = this.baseMapper.queryCompByOrgCode(departExportVo.getOrgCode()); + if (null != depart) { + if (oConvertUtils.isNotEmpty(sysDepart.getParentId())) { + //更新上级部门为叶子节点 + this.updateIzLeaf(sysDepart.getParentId(), CommonConstant.IS_LEAF); + } + //部门名称已存在 + errorMessageList.add("第 " + num + " 行:记录部门名称“" + departExportVo.getDepartName() + "”部门编码重复,请检查!"); + continue; + } + String departNameUrl = departExportVo.getDepartNameUrl(); + //包含/说明是多级 + if (departNameUrl.contains(SymbolConstant.SINGLE_SLASH)) { + //判断添加部门的规则是否和生成的一致 + if (!sysDepart.getOrgCode().equals(departExportVo.getOrgCode())) { + if (oConvertUtils.isNotEmpty(sysDepart.getParentId())) { + //更新上级部门为叶子节点 + this.updateIzLeaf(sysDepart.getParentId(), CommonConstant.IS_LEAF); + } + //部门名称已存在 + errorMessageList.add("第 " + num + " 行:记录部门名称“" + departExportVo.getDepartName() + "”部门编码规则不匹配,请检查!"); + continue; + } + } + sysDepart.setOrgCode(departExportVo.getOrgCode()); + if (oConvertUtils.isNotEmpty(sysDepart.getParentId())) { + //上级 + sysDepart.setOrgType("2"); + } else { + //下级 + sysDepart.setOrgType("1"); + } + } else { + sysDepart.setOrgType(sysDepart.getOrgCode().length() / codeLength + ""); + } + sysDepart.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); + sysDepart.setDepartNameEn(departExportVo.getDepartNameEn()); + sysDepart.setDepartOrder(departExportVo.getDepartOrder()); + sysDepart.setOrgCategory(oConvertUtils.getString(departExportVo.getOrgCategory(), "1")); + sysDepart.setMobile(departExportVo.getMobile()); + sysDepart.setFax(departExportVo.getFax()); + sysDepart.setAddress(departExportVo.getAddress()); + sysDepart.setMemo(departExportVo.getMemo()); + ImportExcelUtil.importDateSaveOne(sysDepart, ISysDepartService.class, errorMessageList, num, CommonConstant.SQL_INDEX_UNIQ_DEPART_ORG_CODE); + departMap.put(departExportVo.getDepartNameUrl(), sysDepart); + } + num++; + } + } - //将非当前机构变更为非指令库 - QueryWrapper uqw1 = new QueryWrapper<>(); - uqw1.ne("org_code",orgCode); - sysDepart.setIzDirectiveMain("N"); - baseMapper.update(sysDepart,uqw1); + @Override + public void changeDirectiveMain(String orgCode) { + SysDepart sysDepart = new SysDepart(); - //将当前机构变更为指令库 - QueryWrapper uqw2 = new QueryWrapper<>(); - uqw2.eq("org_code",orgCode); - sysDepart.setIzDirectiveMain("Y"); - baseMapper.update(sysDepart,uqw2); - } + //将非当前机构变更为非指令库 + QueryWrapper uqw1 = new QueryWrapper<>(); + uqw1.ne("org_code", orgCode); + sysDepart.setIzDirectiveMain("N"); + baseMapper.update(sysDepart, uqw1); - @Override - public void changeElderTagMain(String orgCode) { - SysDepart sysDepart = new SysDepart(); + //将当前机构变更为指令库 + QueryWrapper uqw2 = new QueryWrapper<>(); + uqw2.eq("org_code", orgCode); + sysDepart.setIzDirectiveMain("Y"); + baseMapper.update(sysDepart, uqw2); + } - //将非当前机构变更为非指令库 - QueryWrapper uqw1 = new QueryWrapper<>(); - uqw1.ne("org_code",orgCode); - sysDepart.setIzElderTagMain("N"); - baseMapper.update(sysDepart,uqw1); + @Override + public void changeElderTagMain(String orgCode) { + SysDepart sysDepart = new SysDepart(); - //将当前机构变更为指令库 - QueryWrapper uqw2 = new QueryWrapper<>(); - uqw2.eq("org_code",orgCode); - sysDepart.setIzElderTagMain("Y"); - baseMapper.update(sysDepart,uqw2); - } + //将非当前机构变更为非指令库 + QueryWrapper uqw1 = new QueryWrapper<>(); + uqw1.ne("org_code", orgCode); + sysDepart.setIzElderTagMain("N"); + baseMapper.update(sysDepart, uqw1); - /** - * 寻找部门路径 - * - * @param departVo 部门vo - * @param path 部门路径 - * @param tenantId 租户id - * @param childrenDepart 子部门 - * @param departIdList 部门id集合 - * @param idList 需要查询sql的部门id集合 - */ - private void findSysDepartPath(SysDepartExportVo departVo, List path, Integer tenantId, List childrenDepart, List departIdList, List idList) { - //step 1.查询子部门的数据 - //获取租户id和部门父id获取的部门数据 - List departList = departMapper.getSysDepartList(departVo.getId(), tenantId, idList); - //部门为空判断 - if (departList == null || departList.size() <= 0) { - //判断最后一个子部门是否已拼接 - if (!departIdList.contains(departVo.getId())) { - departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH, path)); - childrenDepart.add(departVo); - } - return; - } + //将当前机构变更为指令库 + QueryWrapper uqw2 = new QueryWrapper<>(); + uqw2.eq("org_code", orgCode); + sysDepart.setIzElderTagMain("Y"); + baseMapper.update(sysDepart, uqw2); + } - for (SysDepartExportVo exportDepartVo : departList) { - //存放子级路径 - List cPath = new ArrayList<>(path); - cPath.add(exportDepartVo.getDepartName()); - //step 2.拼接子部门路径 - if (!departIdList.contains(departVo.getId())) { - departIdList.add(departVo.getId()); - departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH, path)); - childrenDepart.add(departVo); - } - //step 3.递归查询子路径,直到找不到为止 - findSysDepartPath(exportDepartVo, cPath, tenantId, childrenDepart, departIdList, idList); - } - } - //========================end 系统下部门与人员导入 ================================================================== + @Override + public List queryAllAuditPassOrg(SysDepartEntity queryParams) { + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("org_category", "1"); + qw.eq("org_type", "1"); + qw.eq("del_flag", "0"); + if (StringUtils.isNotBlank(queryParams.getOpenId())) { + qw.eq("open_id", queryParams.getOpenId()); + } + qw.orderByDesc("create_time"); + return BeanUtil.copyToList(baseMapper.selectList(qw), SysDepartEntity.class); + } + + /** + * 寻找部门路径 + * + * @param departVo 部门vo + * @param path 部门路径 + * @param tenantId 租户id + * @param childrenDepart 子部门 + * @param departIdList 部门id集合 + * @param idList 需要查询sql的部门id集合 + */ + private void findSysDepartPath(SysDepartExportVo departVo, List path, Integer tenantId, List childrenDepart, List departIdList, List idList) { + //step 1.查询子部门的数据 + //获取租户id和部门父id获取的部门数据 + List departList = departMapper.getSysDepartList(departVo.getId(), tenantId, idList); + //部门为空判断 + if (departList == null || departList.size() <= 0) { + //判断最后一个子部门是否已拼接 + if (!departIdList.contains(departVo.getId())) { + departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH, path)); + childrenDepart.add(departVo); + } + return; + } + + for (SysDepartExportVo exportDepartVo : departList) { + //存放子级路径 + List cPath = new ArrayList<>(path); + cPath.add(exportDepartVo.getDepartName()); + //step 2.拼接子部门路径 + if (!departIdList.contains(departVo.getId())) { + departIdList.add(departVo.getId()); + departVo.setDepartNameUrl(String.join(SymbolConstant.SINGLE_SLASH, path)); + childrenDepart.add(departVo); + } + //step 3.递归查询子路径,直到找不到为止 + findSysDepartPath(exportDepartVo, cPath, tenantId, childrenDepart, departIdList, idList); + } + } + //========================end 系统下部门与人员导入 ================================================================== } From 7aacf62c13f831693e4d1b944a113335e3b0bf74 Mon Sep 17 00:00:00 2001 From: "1378012178@qq.com" <1378012178@qq.com> Date: Wed, 11 Feb 2026 17:28:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9C=BA=E6=9E=84=E5=8A=A0=E7=9B=9F?= =?UTF-8?q?=E3=80=81=E4=BF=A1=E6=81=AF=E5=8F=98=E6=9B=B4=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/OrgAllInfoApiEntity.java | 4 ++++ .../orgapplyinfo/api/OrgApplyInfoApi.java | 19 +++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfoApiEntity.java b/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfoApiEntity.java index dbbbcf2..5ffc08d 100644 --- a/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfoApiEntity.java +++ b/nursing-unit-admin/nu-admin-api/nu-admin-local-api/src/main/java/com/nu/modules/orgapplyinfo/entity/OrgAllInfoApiEntity.java @@ -356,5 +356,9 @@ public class OrgAllInfoApiEntity implements Serializable { */ private java.lang.String handleBy; + /** + * 是否跳过重复校验 + */ + private String izSkipRepetVali; } diff --git a/nursing-unit-api/src/main/java/com/nu/modules/wechat/orgapplyinfo/api/OrgApplyInfoApi.java b/nursing-unit-api/src/main/java/com/nu/modules/wechat/orgapplyinfo/api/OrgApplyInfoApi.java index 4018dc9..66c1b83 100644 --- a/nursing-unit-api/src/main/java/com/nu/modules/wechat/orgapplyinfo/api/OrgApplyInfoApi.java +++ b/nursing-unit-api/src/main/java/com/nu/modules/wechat/orgapplyinfo/api/OrgApplyInfoApi.java @@ -36,13 +36,13 @@ public class OrgApplyInfoApi { } //验证入驻申请信息是否有变更 - if ("1".equals(orgApplyInfoApiEntity.getStatus()) && StringUtils.isNotBlank(orgApplyInfoApiEntity.getPkId())) { + if (!"Y".equals(orgApplyInfoApiEntity.getIzSkipRepetVali()) && "1".equals(orgApplyInfoApiEntity.getStatus()) && StringUtils.isNotBlank(orgApplyInfoApiEntity.getPkId())) { if (!orgApplyInfoApi.validateApplyChanged(orgApplyInfoApiEntity)) { return Result.error("未做变更"); } } //验证机构变更信息是否有变更 - if ("4".equals(orgApplyInfoApiEntity.getStatus())) { + if (!"Y".equals(orgApplyInfoApiEntity.getIzSkipRepetVali()) && "4".equals(orgApplyInfoApiEntity.getStatus())) { if (!orgApplyInfoApi.validateUpInfoChanged(orgApplyInfoApiEntity)) { return Result.error("未做变更"); } @@ -53,17 +53,12 @@ public class OrgApplyInfoApi { } System.out.println("-----------新增/编辑机构加盟申请信息--------tel------------" + orgApplyInfoApiEntity.getTel()); - if (StringUtils.isNotBlank(orgApplyInfoApiEntity.getId()) && !"rz".equals(orgApplyInfoApiEntity.getOptType())) { - orgApplyInfoApi.updateById(orgApplyInfoApiEntity); - return Result.ok("保存成功!"); + //入驻申请 + if ("1".equals(orgApplyInfoApiEntity.getStatus())) { + return Result.ok(orgApplyInfoApi.insertApply(orgApplyInfoApiEntity)); } else { - //入驻申请 - if ("1".equals(orgApplyInfoApiEntity.getStatus())) { - return Result.ok(orgApplyInfoApi.insertApply(orgApplyInfoApiEntity)); - } else { - //变更申请 - return Result.ok(orgApplyInfoApi.insertUpInfo(orgApplyInfoApiEntity)); - } + //变更申请 + return Result.ok(orgApplyInfoApi.insertUpInfo(orgApplyInfoApiEntity)); } }