Commit c7c5d29a authored by fangxinjiang's avatar fangxinjiang

附属信息附件上传接口调整

parent d5472711
package com.yifu.cloud.plus.v1.yifu.archives.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.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -71,9 +72,9 @@ public class TAttaInfo extends Model<TAttaInfo> {
/**
* 关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单)
*/
@NotBlank(message = "关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单)不能为空")
@Length(max = 2, message = "关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单)不能超过2个字符")
@Schema(description = "关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单)")
@NotBlank(message = "关系类型(0员工附件-学历 1 员工附件-伤残 2.员工附件-职业)不能为空")
@Length(max = 2, message = "关系类型(0员工附件-学历 1 员工附件-伤残 2.员工附件-职业)不能超过2个字符")
@Schema(description = "关系类型(0员工附件-学历 1 员工附件-伤残 2.员工附件-职业)")
private String relationType;
/**
* 实体id和关系类型共同确定附件所属
......@@ -82,4 +83,12 @@ public class TAttaInfo extends Model<TAttaInfo> {
@Length(max = 32, message = "实体id和关系类型共同确定附件所属不能超过32个字符")
@Schema(description = "实体id和关系类型共同确定附件所属")
private String domainId;
/**
* 地址URL
*/
@Length(max = 100, message = "地址URL不能超过100个字符")
@Schema(description = "地址URL")
@TableField(exist = false)
private String attaUrl;
}
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -19,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author fang
......@@ -87,6 +89,7 @@ public class FileUploadController {
attaInfo = initUnitAttaForInsert(fileName, key, file.getSize());
attaInfo.setRelationType(String.valueOf(type));
try {
attaInfo.setDomainId(domain);
attaInfo = tAttaInfoService.add(attaInfo);
} catch (Exception e) {
log.error("OSS文件上传接口异常:" + e.getMessage());
......@@ -95,7 +98,6 @@ public class FileUploadController {
}
//有实体id则插入关系,用于编辑
if (Common.isNotNull(domain)) {
attaInfo.setDomainId(domain);
url = ossUtil.getObjectUrl(null, attaInfo.getAttaSrc());
fileVo = new FileVo(attaInfo.getId(), attaInfo.getAttaName(), url.toString());
return R.ok(fileVo, "success");
......@@ -140,7 +142,6 @@ public class FileUploadController {
/**
* 对象初始化
*
* @param fileName
* @param key
* @param fileSize
......@@ -165,4 +166,27 @@ public class FileUploadController {
unitAtta.setCreateUser(null == user ? "" : user.getId().toString());
return unitAtta;
}
/**
* 获取附件下载地址
*
* @param id
* @return
* @Author fxj
* @Date 2019-08-16
* @param id domainId
**/
@Operation(description = "附件预览下载地址 type:关系类型(0员工附件-学历 1 员工附件-伤残 2.员工附件-职业")
@GetMapping("/ossFileUrl/{id}")
public R<List<TAttaInfo>> ossFileUrl(@PathVariable String id) {
List<TAttaInfo> attas = tAttaInfoService.list(Wrappers.<TAttaInfo>query().lambda().eq(TAttaInfo::getDomainId,id));
if (Common.isEmpty(attas)) {
return R.failed("无对应附件信息");
}
for (TAttaInfo atta:attas){
URL url = ossUtil.getObjectUrl(null, atta.getAttaSrc());
atta.setAttaUrl(url.toString());
}
return new R<>(attas);
}
}
......@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 员工学历信息表
......@@ -30,4 +31,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TEmpEducationMapper extends BaseMapper<TEmpEducation> {
int updateHighIdentification(@Param("empIdcard") String empIdcard);
}
......@@ -42,4 +42,6 @@ public interface TEmpEducationService extends IService<TEmpEducation> {
R<Boolean> saveDiy(TEmpEducation tEmpEducation);
R<List<ErrorMessage>> importEmpEducationUpdate(List<EmpEducationUpdateExcelVo> excelVOList, BindingResult bindingResult);
R<Boolean> insertEducationOfEmp(TEmpEducation education);
}
......@@ -92,6 +92,7 @@ public class TEmpDisabilityInfoServiceImpl extends ServiceImpl<TEmpDisabilityInf
@Override
public R<Boolean> saveDiy(TEmpDisabilityInfo tEmpDisabilityInfo) {
tEmpDisabilityInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
int res = baseMapper.insert(tEmpDisabilityInfo);
if (res > CommonConstants.ZERO_INT){
//更新附件信息
......
......@@ -121,12 +121,12 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
TEmpEducation education = baseMapper.selectOne(Wrappers.<TEmpEducation>query().lambda()
.eq(TEmpEducation::getEmpIdcard,tEmpEducation.getEmpIdcard())
.eq(TEmpEducation::getEducationName,tEmpEducation.getEducationName())
.eq(TEmpEducation::getId,tEmpEducation.getId())
.ne(TEmpEducation::getId,tEmpEducation.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(education)){
return R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_EDUCATION_EXISTING, tEmpEducation.getEducationName()));
}
updateEducationOfEmp(education);
updateEducationOfEmp(tEmpEducation);
baseMapper.updateById(tEmpEducation);
return R.ok();
}
......@@ -147,7 +147,8 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
return R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_EDUCATION_EXISTING, tEmpEducation.getEducationName()));
}
//更新档案信息
updateEducationOfEmp(education);
updateEducationOfEmp(tEmpEducation);
tEmpEducation.setDeleteFlag(CommonConstants.ZERO_STRING);
baseMapper.insert(tEmpEducation);
//更新附件信息
List<String> ids;
......@@ -258,4 +259,15 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
this.save(insert);
}
@Override
public R<Boolean> insertEducationOfEmp(TEmpEducation education){
if (Common.isEmpty(education) && Common.isEmpty(education.getHighIdentification())){
return R.failed(CommonConstants.SAVE_FAILED);
}
if (CommonConstants.ZERO_STRING.equals(education.getHighIdentification())){
baseMapper.updateHighIdentification(education.getEmpIdcard());
}
return R.ok(baseMapper.insert(education) > 0);
}
}
......@@ -43,6 +43,7 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
@Override
public R<Boolean> saveDiy(TEmpProfessionalQualification qualification) {
qualification.setDeleteFlag(CommonConstants.ZERO_STRING);
int res = baseMapper.insert(qualification);
if (res <= CommonConstants.ZERO_INT){
return R.failed();
......
......@@ -119,6 +119,7 @@ public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingM
@Override
public R<Boolean> saveDiy(TEmpWorkRecording recording) {
recording.setDeleteFlag(CommonConstants.ZERO_STRING);
String res = checkRepeat(recording);
if (Common.isEmpty(res)){
this.save(recording);
......
......@@ -50,4 +50,10 @@
<result property="certificationName" column="CERTIFICATION_NAME"/>
</resultMap>
<update id="updateHighIdentification" parameterType="java.lang.String">
update t_emp_education
set HIGH_IDENTIFICATION='1'
WHERE EMP_IDCARD=#{empIdcard}
</update>
</mapper>
......@@ -129,10 +129,10 @@
update t_employee_info
<trim prefix="set" suffixOverrides=",">
<if test="education.isCollege != null">is_college=#{education.isCollege},</if>
<if test="education.hignEducation != null">hign_education=#{education.hignEducation},</if>
<if test="education.highIdentification != null">hign_education=#{education.highIdentification},</if>
<if test="education.school != null">school=#{education.school},</if>
<if test="education.major != null">major=#{education.major},</if>
<if test="education.admissionDate != null">admission_date=#{education.admissionDate},</if>
<if test="education.entryDate != null">admission_date=#{education.entryDate},</if>
<if test="education.gradutionDate != null">gradution_date=#{education.gradutionDate},</if>
</trim>
WHERE id=#{education.empId}
......
......@@ -11,9 +11,6 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import java.util.HashMap;
import java.util.Map;
......@@ -29,11 +26,11 @@ public class ChecksUtil {
private static final String APP_ID = "oi0mucL4";
private static final String APP_KEY = "s4lW5JRA";
private static final String API_URL = "https://api.253.com/open/idcard/id-card-auth";
private static JsonParser jsonParser = new JsonParser();
private static final String APP_KEY_IDCARD = "s4lW5JRA";
private static final String API_URL = "https://api.253.com/open/idcard/id-card-auth";
private static final String API_URL_MOBILE = "https://api.253.com/open/unn/batch-ucheck";
private static final String API_URL_BANK_NO ="https://api.253.com/open/bankcard/card-auth";
private static JsonParser jsonParser = new JsonParser();
public static void checkIdCard(TCheckIdCard checkIdCard, boolean canCheck) {
......@@ -70,10 +67,9 @@ public class ChecksUtil {
* @param mobile 银行预留手机号,仅支持国内11位号码
**/
public static R<TCheckBankNo> checkBankNo(String name, String idNum, String cardNo, String mobile, boolean canCheck) {
TCheckBankNo checkBankNo = new TCheckBankNo();
if (canCheck) {
// 1.调用身份信息校验api
return checkBankNoMethod(name,idNum,cardNo,mobile,checkBankNo);
return checkBankNoMethod(name,idNum,cardNo,mobile);
} else {
return R.failed(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
}
......@@ -82,9 +78,9 @@ public class ChecksUtil {
private static R<TCheckBankNo> checkBankNoMethod(String name,
String idNum,
String cardNo,
String mobile,
TCheckBankNo checkBankNo) {
String mobile) {
final JsonObject jsonObject = ChecksUtil.invokeBankNo(name,idNum,cardNo,mobile);
TCheckBankNo checkBankNo = new TCheckBankNo();
// 2.处理返回结果
if (jsonObject != null) {
//响应code码。200000:成功,其他失败
......@@ -95,17 +91,15 @@ public class ChecksUtil {
// 校验状态码 200000:成功,其他失败
JsonObject resJson = jsonObject.get(ChecksConstants.DATA).getAsJsonObject();
String message = jsonObject.get(ChecksConstants.MESSAGE).getAsString();
JsonElement temp;
if (Common.isNotNull(resJson)){
TCheckBankNo bankNo = new TCheckBankNo();
bankNo.setBankNo(getJsonElementValue(resJson.getAsJsonObject().get("bankNo")));
bankNo.setBankName(getJsonElementValue(resJson.getAsJsonObject().get("bankName")));
bankNo.setCardCategory(getJsonElementValue(resJson.getAsJsonObject().get("cardCategory")));
bankNo.setCardType(getJsonElementValue(resJson.getAsJsonObject().get("cardType")));
bankNo.setResult(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.RESULT)));
bankNo.setMessage(message);
bankNo.setRemark(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.REMARK)));
bankNo.setType(CommonConstants.ONE_STRING);
checkBankNo.setBankNo(cardNo);
checkBankNo.setBankName(getJsonElementValue(resJson.getAsJsonObject().get("bankName")));
checkBankNo.setCardCategory(getJsonElementValue(resJson.getAsJsonObject().get("cardCategory")));
checkBankNo.setCardType(getJsonElementValue(resJson.getAsJsonObject().get("cardType")));
checkBankNo.setResult(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.RESULT)));
checkBankNo.setMessage(message);
checkBankNo.setRemark(getJsonElementValue(resJson.getAsJsonObject().get(ChecksConstants.REMARK)));
checkBankNo.setType(CommonConstants.ONE_STRING);
}
} else {
// 记录错误日志,正式项目中请换成log打印
......@@ -137,9 +131,8 @@ public class ChecksUtil {
// 调用身份信息校验成功
// 解析结果数据,进行业务处理
// 校验状态码 200000:成功,其他失败
JsonObject resJson = jsonObject.get(ChecksConstants.DATA).getAsJsonObject();
JsonArray mobileArray = jsonObject.get(ChecksConstants.DATA).getAsJsonArray();
String message = jsonObject.get(ChecksConstants.MESSAGE).getAsString();
JsonArray mobileArray = resJson.getAsJsonArray();
if (Common.isNotNull(mobileArray) && mobileArray.size() > CommonConstants.ZERO_INT){
TCheckMobile mobile = null;
for (int i = 0;i < mobileArray.size(); i++){
......@@ -199,7 +192,7 @@ public class ChecksUtil {
private static JsonObject invokeIdCard(String name, String idNum) {
Map<String, String> params = new HashMap<>();
params.put(ChecksConstants.APP_ID, APP_ID);
params.put(ChecksConstants.APP_KEY, APP_KEY);
params.put(ChecksConstants.APP_KEY, APP_KEY_IDCARD);
params.put(ChecksConstants.NAME, name);
params.put(ChecksConstants.ID_NUM, idNum);
String result = HttpUtils.post(API_URL, params);
......@@ -216,9 +209,9 @@ public class ChecksUtil {
private static JsonObject invokeMobile(String mobiles) {
Map<String, String> params = new HashMap<>();
params.put(ChecksConstants.APP_ID, APP_ID);
params.put(ChecksConstants.APP_KEY, APP_KEY);
params.put(ChecksConstants.APP_KEY, APP_KEY_IDCARD);
params.put(ChecksConstants.MOBILES, mobiles);
String result = HttpUtils.post(API_URL, params);
String result = HttpUtils.post(API_URL_MOBILE, params);
// 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject();
}
......@@ -226,12 +219,14 @@ public class ChecksUtil {
private static JsonObject invokeBankNo(String name, String idNum, String cardNo, String mobile) {
Map<String, String> params = new HashMap<>();
params.put(ChecksConstants.APP_ID, APP_ID);
params.put(ChecksConstants.APP_KEY, APP_KEY);
params.put(ChecksConstants.APP_KEY, APP_KEY_IDCARD);
params.put(ChecksConstants.NAME, name);
params.put(ChecksConstants.ID_NUM, idNum);
params.put(ChecksConstants.CARD_NO, cardNo);
params.put(ChecksConstants.MOBILE, mobile);
String result = HttpUtils.post(API_URL, params);
if (Common.isNotNull(mobile)){
params.put(ChecksConstants.MOBILE, mobile);
}
String result = HttpUtils.post(API_URL_BANK_NO, params);
// 解析json,并返回结果
return jsonParser.parse(result).getAsJsonObject();
}
......
......@@ -118,7 +118,7 @@ public class TCheckMobileController {
*/
@Operation(description = "检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码")
@SysLog("检测手机号状态" )
@Inner
//@Inner
@GetMapping("/checkMobiles" )
public R checkMobiles(String mobiles) {
return R.ok(tCheckMobileService.checkMobiles(mobiles));
......
......@@ -43,7 +43,7 @@ import java.util.Map;
@Service
public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCheckMobile> implements TCheckMobileService {
private TCanCheckService canCheckService;
private final TCanCheckService canCheckService;
/**
* @Author fxj
* @Description 号码状态校验,单次请求上限100 多一个号码请以逗号分割
......
......@@ -198,4 +198,5 @@ public interface CommonConstants {
//int 4
int FOUR_INT = 4;
String TEN_STRING = "10";
String SAVE_FAILED = "保存失败!";
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.dapr.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/*
*
*
* @author fxj
* @date 2022-05-23 14:28
**/
@Data
@Component
@PropertySource("classpath:daprConfig.properties")
@ConfigurationProperties(value = "dapr.check", ignoreInvalidFields = false)
public class DaprCheckProperties {
/*
* @author fxj
* @date 14:34
* @Description dapr sidercar url 如:http://localhost:3005/v1.0/invoke/
**/
String appUrl;
/*
* @author fxj
* @date 14:35
* @decription app_id 如:"yifu_upms_sider"
**/
String appId;
}
......@@ -42,5 +42,5 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
* @Description 获取type 对应的子字典项数目
* @Date 10:21 2022/6/21
**/
int selectChildDictItemCount(@Param("parentItemType")String parentItemType);
int selectChildDictItemCount(@Param("parentItemType")String parentItemType, @Param("parentId")String parentId);
}
......@@ -51,5 +51,5 @@ public interface SysDictService extends IService<SysDict> {
String getParentDicLabelById(String type, String value);
int selectChildDictItemCount(String parentItemType);
int selectChildDictItemCount(String parentItemType, String parentId);
}
......@@ -139,7 +139,8 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
@Override
public R<Boolean> removeDictItemDiy(Long id) {
SysDictItem entity = baseMapper.selectById(id);
if (Common.isNotNull(entity) && Common.isNotNull(dictService.selectChildDictItemCount(entity.getType()))){
int res = dictService.selectChildDictItemCount(entity.getType(),entity.getValue());
if (Common.isNotNull(entity) && dictService.selectChildDictItemCount(entity.getType(),entity.getValue()) > 0){
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_DICT_ITEM_DELETE_EXIST_CHILD));
}
return R.ok(baseMapper.deleteById(id) > 0);
......@@ -153,7 +154,7 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
private LambdaQueryWrapper buildQueryWrapper(SysDictItem sysDictItem) {
LambdaQueryWrapper<SysDictItem> wrapper = Wrappers.lambdaQuery();
if (StrUtil.isNotBlank(sysDictItem.getType())){
wrapper.likeRight(SysDictItem::getType,sysDictItem.getType());
wrapper.eq(SysDictItem::getType,sysDictItem.getType());
}
wrapper.orderByAsc(SysDictItem::getSortOrder);
return wrapper;
......
......@@ -113,8 +113,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
* @Date 10:21 2022/6/21
**/
@Override
public int selectChildDictItemCount(String parentItemType) {
return baseMapper.selectChildDictItemCount(parentItemType);
public int selectChildDictItemCount(String parentItemType, String parentId) {
return baseMapper.selectChildDictItemCount(parentItemType,parentId);
}
/**
......
......@@ -50,6 +50,7 @@
a.type = #{type}
AND i.`value` = a.parent_id
AND a.`value` = #{value}
AND i.del_flag='0' limit 1
</select>
<select id="selectChildDictItemCount" resultType="java.lang.Integer">
......@@ -67,6 +68,7 @@
LEFT JOIN sys_dict c ON c.type = a.type
WHERE
c.parent_item_type = #{parentItemType}
and t.parent_id= #{parentId} and t.del_flag='0'
)
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment