机构、模板管理优化接口

This commit is contained in:
hejinbo
2023-11-22 11:51:51 +08:00
parent 765c444a16
commit 80523e71d1
6 changed files with 46 additions and 18 deletions
@@ -22,6 +22,8 @@ public class DeptIdentify extends BaseEntity {
private Integer isUse;
/** 经办人姓名 */
private String operName;
/** 经办人用户名 */
private String operUserName;
/** 经办人手机号 */
private String operPhone;
@@ -33,6 +35,15 @@ public class DeptIdentify extends BaseEntity {
/** 部门认证链接 */
private String identifyUrl;
/** 机构信用代码 */
private String creditCode;
/** 法人姓名 */
private String legalPerName;
/** 法人手机号 */
private String legalPerPhone;
/** 机构类型(1 仲裁机构) */
private Integer identifyType;
@@ -29,7 +29,10 @@ public class TemplateManage extends BaseEntity {
* 模板格式
*/
private String temFormat;
/**
* 文件名
*/
private String fileName;
/**
* 原模板路径
*/
@@ -329,11 +329,14 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
Long deptId = sysDept.getDeptId();
SysUser sysUser = new SysUser();
sysUser.setDeptId(deptId);
sysUser.setUserName(generateUniqueUsername());//设置默认的用户名
sysUser.setUserName(deptIdentify.getOperUserName());
sysUser.setNickName(operName);
sysUser.setPhonenumber(operPhone);
SysUser sysUser1 = sysUserMapper.selectUserByUserName(deptIdentify.getOperUserName());
if (sysUser1== null) {
sysUserMapper.insertUser(sysUser);
}
}
return AjaxResult.success("新增成功");
}
@@ -394,6 +397,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
templateManage.setTemOrigPath(annexPath);
String format = getFileExtension(fileName);
templateManage.setTemFormat(format);
String subFileName = fileName.substring(fileName.lastIndexOf("/")+1);
templateManage.setFileName(subFileName);
templateManage.setCreateBy(getUsername());
int i = templateManageMapper.insertTemplateManage(templateManage);
if (i > 0) {
@@ -421,6 +426,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
startIndex += prefix.length();
String annexPath = "uploadPath" + fileName.substring(startIndex);
templateManage.setTemOrigPath(annexPath);
String subFileName = fileName.substring(fileName.lastIndexOf("/")+1);
templateManage.setFileName(subFileName);
String format = getFileExtension(fileName);
templateManage.setTemFormat(format);
}
@@ -468,19 +475,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
return templateManages;
}
private String generateUniqueUsername() {
final Random random = new Random();
final Set<String> generatedUsernames = new HashSet<>();
while (true) {
int min = 000000; // 最小的六位数
int max = 999999; // 最大的六位数
int randomNum = random.nextInt(max - min + 1) + min;
if (!generatedUsernames.contains(randomNum)) {
generatedUsernames.add(String.valueOf(randomNum));
return String.valueOf(randomNum);
}
}
}
private String getFileExtension(String fileName) {
int lastDotIndex = fileName.lastIndexOf(".");
@@ -262,6 +262,9 @@ public class FixSelectFlowDetailUtils {
deptIdentify1.setIsUse(0); //默认机构为未启用
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
}
}else {
deptIdentify1.setIdentifyStatus(2);
deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
}
}
@@ -15,13 +15,16 @@
<result property="operPhone" column="oper_phone" />
<result property="identifyType" column="identify_type" />
<result property="delFlag" column="del_flag" />
<result property="creditCode" column="credit_code" />
<result property="legalPerName" column="legal_per_name" />
<result property="legalPerPhone" column="legal_per_phone" />
</resultMap>
<select id="selectDeptIdentify" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
SELECT id, identify_name ,identify_status , identify_date,is_use,org_id,auth_flow_id,
oper_name,oper_phone,identify_type
oper_name,oper_phone,identify_type,credit_code,legal_per_name,legal_per_phone
FROM dept_identify
<where>
<if test="id != null">
@@ -59,6 +62,9 @@
<if test="operPhone != null and operPhone != ''">oper_phone,</if>
<if test="identifyType != null">identify_type,</if>
<if test="authFlowId != null and authFlowId != ''">auth_flow_id,</if>
<if test="creditCode != null and creditCode != ''">credit_code,</if>
<if test="legalPerName != null and legalPerName != ''">legal_per_name,</if>
<if test="legalPerPhone != null and legalPerPhone != ''">legal_per_phone,</if>
del_flag
)values(
<if test="identifyName != null and identifyName != ''">#{identifyName},</if>
@@ -70,6 +76,9 @@
<if test="operPhone != null and operPhone != ''">#{operPhone},</if>
<if test="identifyType != null ">#{identifyType},</if>
<if test="authFlowId != null and authFlowId != '' ">#{authFlowId},</if>
<if test="creditCode != null and creditCode != '' ">#{creditCode},</if>
<if test="legalPerName != null and legalPerName != '' ">#{legalPerName},</if>
<if test="legalPerPhone != null and legalPerPhone != '' ">#{legalPerPhone},</if>
0
)
</insert>
@@ -90,6 +99,9 @@
<if test="delFlag != null ">del_flag = #{delFlag},</if>
<if test="operName != null ">oper_name = #{operName},</if>
<if test="operPhone != null ">oper_phone = #{operPhone},</if>
<if test="creditCode != null ">credit_code = #{creditCode},</if>
<if test="legalPerName != null ">legal_per_name = #{legalPerName},</if>
<if test="legalPerPhone != null ">legal_per_phone = #{legalPerPhone},</if>
<if test="authFlowId != null and authFlowId != '' ">auth_flow_id = #{authFlowId}</if>
</set>
<where>
@@ -12,6 +12,7 @@
<result property="temOrigPath" column="tem_orig_path" />
<result property="temRevisPath" column="tem_revis_path" />
<result property="delFlag" column="del_flag" />
<result property="fileName" column="file_name" />
</resultMap>
<insert id="insertTemplateManage" parameterType="TemplateManage" useGeneratedKeys="true" keyProperty="id">
@@ -23,6 +24,7 @@
<if test="temOrigPath != null and temOrigPath != '' ">tem_orig_path,</if>
<if test="temRevisPath != null and temRevisPath != '' ">tem_revis_path,</if>
<if test="createBy != null and createBy != '' ">create_by,</if>
<if test="fileName != null and fileName != '' ">file_name,</if>
del_flag,create_time
)values(
<if test="identifyId != null">#{identifyId},</if>
@@ -32,6 +34,7 @@
<if test="temOrigPath != null and temOrigPath != ''">#{temOrigPath},</if>
<if test="temRevisPath != null and temRevisPath != ''">#{temRevisPath},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="fileName != null and fileName != ''">#{fileName},</if>
0,sysdate()
)
</insert>
@@ -47,6 +50,7 @@
<if test="delFlag != null ">del_flag = #{delFlag},</if>
<if test="temRevisPath != null and temRevisPath != '' ">tem_revis_path = #{temRevisPath},</if>
<if test="updateBy != null and updateBy != '' ">update_by = #{updateBy},</if>
<if test="fileName != null and fileName != '' ">file_name = #{fileName},</if>
update_time = sysdate()
</set>
<where>
@@ -58,7 +62,7 @@
</update>
<select id="selectTemplateList" parameterType="TemplateManage" resultMap="TemplateManageResult">
SELECT id, identify_id ,tem_name , tem_type,tem_format,tem_orig_path,tem_revis_path
SELECT id, identify_id ,tem_name , tem_type,tem_format,tem_orig_path,tem_revis_path ,file_name
FROM template_manage
<where>
<if test="id != null">