企业地区调整

This commit is contained in:
韩国东 2022-11-01 17:30:53 +08:00
parent 6e623b4f5d
commit f25ae4df68
9 changed files with 93 additions and 97 deletions

View File

@ -25,6 +25,9 @@ public class SysEnterpriseDo {
@ApiModelProperty("组/网格id")
private String netCode;
@ApiModelProperty("地区id")
private String areaCode;
@ApiModelProperty("安全类别")
private String baseinclassid;
@ -85,6 +88,14 @@ public class SysEnterpriseDo {
@ApiModelProperty("企业简介")
private String comments;
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getComments() {
return comments;
}

View File

@ -20,8 +20,6 @@ public interface SysOrgMapper extends BaseMapper<SysOrg> {
int deleteByPrimaryKey(String orgcode);
int insert(SysOrg record);
int insertSelective(SysOrg record);
List<SysOrg> selectByExample(SysOrgExample example);

View File

@ -34,8 +34,6 @@ public interface SysEnterpriseMapper extends BaseMapper<SysEnterprise> {
int deleteByPrimaryKey(String sysenterpriseid);
int insert(SysEnterprise record);
int insertSelective(SysEnterprise record);

View File

@ -380,6 +380,30 @@ public class SysEnterprise implements Serializable {
private static final long serialVersionUID = 1L;
public String getAreaCode() {
return areaCode;
}
public void setAreaCode(String areaCode) {
this.areaCode = areaCode;
}
public String getAreaPath() {
return areaPath;
}
public void setAreaPath(String areaPath) {
this.areaPath = areaPath;
}
public String getAreaName() {
return areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public Integer getCheckCount() {
return checkCount;
}

View File

@ -113,16 +113,6 @@
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.SysOrg">
insert into SysOrg (OrgCode, OrgName, OrgLevel,charger,
SuperiorOrgCode, CreatedBy, CreatedOn,
ModifiedBy, ModifiedOn)
values (#{orgcode,jdbcType=VARCHAR}, #{orgname,jdbcType=VARCHAR},
#{orglevel,jdbcType=INTEGER},
#{charger,jdbcType=VARCHAR},
#{superiororgcode,jdbcType=VARCHAR}, #{createdby,jdbcType=VARCHAR}, #{createdon,jdbcType=TIMESTAMP},
#{modifiedby,jdbcType=VARCHAR}, #{modifiedon,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.SysOrg">
insert into SysOrg
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -356,6 +346,9 @@
OrgLevel = #{orglevel,jdbcType=INTEGER},
SuperiorOrgCode = #{superiororgcode,jdbcType=VARCHAR},
charger = #{charger,jdbcType=VARCHAR},
sort_id = #{sortId,jdbcType=VARCHAR},
parent_path = #{parentPath,jdbcType=VARCHAR},
parent_name = #{parentName,jdbcType=VARCHAR},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP}
where OrgCode = #{orgcode,jdbcType=VARCHAR}

View File

@ -92,63 +92,7 @@
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.rzyc.model.ent.SysEnterprise">
insert into SysEnterprise (SysEnterpriseId,
OrgCode,
street_code,
community_code,
net_code,
SuperiorEnterpriseId,
LowOrgCode, EntName,isHide, State,complite,sysUnitId,ManagerDept,dynamicRiskLevel,inherentRisk,manageType,EntType,
EntSection, BaseSafeClassId, BaseInClassId,work_class_id,
PinYin, Principal,
SysAddress,
safeTelephone,
safeManager,
PostCode, EcoType, PersonCount,
EntLogoPic, MaleCode, OrgPassNo,
LegalRepre, LRIDCard, LRLinkTel,
EstablishDate, RiskLevel, Latitude,
Longitude, IsBlackList, Comments,
ISMaleCode, EntScore, EntHouseNum,
CreatedOn, CreatedBy, ModifiedOn,
ModifiedBy,qr_code)
values (
#{sysenterpriseid,jdbcType=VARCHAR},
#{orgcode,jdbcType=VARCHAR},
#{streetCode,jdbcType=VARCHAR},
#{communityCode,jdbcType=VARCHAR},
#{netCode,jdbcType=VARCHAR},
#{superiorenterpriseid,jdbcType=VARCHAR},
#{loworgcode,jdbcType=VARCHAR},
#{entname,jdbcType=VARCHAR},
#{isHide,jdbcType=VARCHAR},
#{state,jdbcType=VARCHAR},
#{complite,jdbcType=VARCHAR},
#{sysUnitId,jdbcType=VARCHAR},
#{managerDept,jdbcType=VARCHAR},
#{dynamicRiskLevel,jdbcType=VARCHAR},
#{inherentRisk,jdbcType=VARCHAR},
#{manageType,jdbcType=VARCHAR},
#{enttype,jdbcType=VARCHAR},
#{entsection,jdbcType=VARCHAR}, #{basesafeclassid,jdbcType=VARCHAR},
#{baseinclassid,jdbcType=VARCHAR},
#{workClassId,jdbcType=VARCHAR},
#{pinyin,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR},
#{sysaddress,jdbcType=VARCHAR},
#{safeTelephone,jdbcType=VARCHAR},
#{safeManager,jdbcType=VARCHAR},
#{postcode,jdbcType=VARCHAR}, #{ecotype,jdbcType=VARCHAR}, #{personcount,jdbcType=INTEGER},
#{entlogopic,jdbcType=VARCHAR}, #{malecode,jdbcType=VARCHAR}, #{orgpassno,jdbcType=VARCHAR},
#{legalrepre,jdbcType=VARCHAR}, #{lridcard,jdbcType=VARCHAR}, #{lrlinktel,jdbcType=VARCHAR},
#{establishdate,jdbcType=TIMESTAMP}, #{risklevel,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR},
#{longitude,jdbcType=VARCHAR}, #{isblacklist,jdbcType=VARCHAR}, #{comments,jdbcType=VARCHAR},
#{ismalecode,jdbcType=VARCHAR}, #{entscore,jdbcType=VARCHAR}, #{enthousenum,jdbcType=VARCHAR},
#{createdon,jdbcType=TIMESTAMP}, #{createdby,jdbcType=VARCHAR}, #{modifiedon,jdbcType=TIMESTAMP},
#{modifiedby,jdbcType=VARCHAR},#{qrCode})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.ent.SysEnterprise">
insert into SysEnterprise
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -586,7 +530,9 @@
street_code = #{streetCode,jdbcType=VARCHAR},
community_code = #{communityCode,jdbcType=VARCHAR},
OrgCode = #{orgcode,jdbcType=VARCHAR},
OrgCode = #{orgcode,jdbcType=VARCHAR},
area_code = #{areaCode,jdbcType=VARCHAR},
area_path = #{areaPath,jdbcType=VARCHAR},
area_name = #{areaName,jdbcType=VARCHAR},
SuperiorEnterpriseId = #{superiorenterpriseid,jdbcType=VARCHAR},
LowOrgCode = #{loworgcode,jdbcType=VARCHAR},
EntName = #{entname,jdbcType=VARCHAR},
@ -801,9 +747,7 @@
#{inherentRisk}
</foreach>
</if>
AND (sys.`OrgCode` = #{areaCode}
OR sys.`street_code` = #{areaCode}
OR sys.`community_code` = #{areaCode})
AND FIND_IN_SET(#{areaCode},sys.area_path)
<if test="null != entName and '' != entName">
and sys.EntName like concat('%',#{entName},'%')
</if>

View File

@ -2725,7 +2725,7 @@ public class BaseController {
}
/**
* 获取用户地区id
* 获取用户地区idchangeArea
* @return
* @throws Exception
*/

View File

@ -868,9 +868,30 @@ public class SettingController extends BaseController{
sysOrg.setModifiedon(new Date());
sysOrg.setCreatedon(new Date());
//计算东区等级
if(StringUtils.isNotBlank(sysOrg.getSuperiororgcode())){
SysOrg superOrg = sysOrgMapper.selectByPrimaryKey(sysOrg.getSuperiororgcode());
if(StringUtils.isNotBlank(sysOrg.getOrgcode())){
handleAreaParent(sysOrg.getSuperiororgcode(),sysOrg);
sysOrgMapper.changeArea(sysOrg);
}else{
sysOrg.setOrgcode(RandomNumber.getUUid());
handleAreaParent(sysOrg.getSuperiororgcode(),sysOrg);
sysOrgMapper.insert(sysOrg);
}
return result;
}
/**
* 处理地区信息
* @version v1.0
* @author dong
* @date 2022/11/1 14:20
*/
public void handleAreaParent(String superiororgcod,SysOrg sysOrg)throws Exception{
//计算地区等级
if(StringUtils.isNotBlank(superiororgcod)){
SysOrg superOrg = sysOrgMapper.selectById(superiororgcod);
if(null != superOrg){
Integer orgLevel = superOrg.getOrglevel();
orgLevel += 1;
@ -883,16 +904,6 @@ public class SettingController extends BaseController{
sysOrg.setParentName(sysOrg.getOrgname());
sysOrg.setOrglevel(2);
}
if(StringUtils.isNotBlank(sysOrg.getOrgcode())){
sysOrgMapper.changeArea(sysOrg);
}else{
sysOrg.setOrgcode(RandomNumber.getUUid());
sysOrgMapper.insert(sysOrg);
}
return result;
}

View File

@ -564,12 +564,16 @@ public class PcCompanyController extends com.rzyc.controller.BaseController {
singleResult.setCode(Code.ERROR.getCode());
return singleResult;
}
getEntAreaCode(sysEnterpriseDo.getAreaCode(),sysEnterprise);
sysEnterprise.setCreatedon(new Date());
sysEnterprise.setModifiedon(new Date());
sysEnterprise.setSysenterpriseid(RandomNumber.getUUid());
sysEnterprise.setDynamicRiskLevel("100");//新建企业默认100分数
sysEnterprise.setQrCode(entQrCode(sysEnterprise.getSysenterpriseid()));
result = sysEnterpriseMapper.insert(sysEnterprise);
sysEnterpriseMapper.insert(sysEnterprise);
}else {
SysEnterprise verifyEnterprise = sysEnterpriseMapper.selectByName(sysEnterpriseDo.getEntname(),sysEnterpriseDo.getSysenterpriseid());
@ -585,8 +589,10 @@ public class PcCompanyController extends com.rzyc.controller.BaseController {
sysEnterprise.setQrCode(entQrCode(sysEnterprise.getSysenterpriseid()));
}
getEntAreaCode(sysEnterpriseDo.getAreaCode(),sysEnterprise);
sysEnterprise.setModifiedon(new Date());
result = sysEnterpriseMapper.updateByPrimaryKey(sysEnterprise);
sysEnterpriseMapper.updateByPrimaryKey(sysEnterprise);
}
@ -596,17 +602,28 @@ public class PcCompanyController extends com.rzyc.controller.BaseController {
//创建或者修改企业用户
createEntUser(sysEnterprise,sysUser.getChinaname(),sysUser);
if (result > 0){
singleResult.setMessage(Message.SUCCESS);
singleResult.setCode(Code.SUCCESS.getCode());
}else {
singleResult.setMessage(Message.ERROR);
singleResult.setCode(Code.ERROR.getCode());
}
return singleResult;
}
/**
* 处理企业地区信息
* @version v1.0
* @author dong
* @date 2022/11/1 14:40
*/
public void getEntAreaCode(String areaCode,SysEnterprise enterprise)throws Exception{
if(StringUtils.isNotBlank(areaCode)){
SysOrg sysOrg = sysOrgMapper.selectById(areaCode);
if(null != sysOrg){
enterprise.setAreaCode(areaCode);
enterprise.setAreaPath(sysOrg.getParentPath());
enterprise.setAreaName(sysOrg.getParentName());
}
}
}