Commit 9679e59f authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents e6f2ae94 a5a8f0d7
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;
......@@ -257,5 +258,36 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
updateEducationOfEmp(insert);
this.save(insert);
}
/**
* @Author fxj
* @Description 档案新增或更新学历专用接口
* @Date 9:35 2022/6/22
**/
@Transactional
@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());
}
TEmpEducation exist = baseMapper.selectOne(Wrappers.<TEmpEducation>query().lambda()
.eq(TEmpEducation::getEducationName,education.getEducationName())
.eq(TEmpEducation::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmpEducation::getEmpIdcard,education.getEducationName())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
exist.setHighIdentification(education.getHighIdentification());
exist.setSchool(education.getType());
exist.setMajor(education.getMajor());
exist.setEntryDate(education.getEntryDate());
exist.setGradutionDate(education.getGradutionDate());
baseMapper.updateById(exist);
}else {
baseMapper.insert(education);
}
return R.ok();
}
}
......@@ -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>
......@@ -131,10 +131,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}
......
......@@ -157,117 +157,6 @@
</foreach>
</update>
<update id="updateExcelEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_NATRUE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empNatrue!=null">
when ID=#{i.id} then #{i.empNatrue}
</if>
</foreach>
</trim>
<trim prefix="EMP_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empName!=null">
when ID=#{i.id} then #{i.empName}
</if>
</foreach>
</trim>
<trim prefix="EMP_IDCARD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empIdcard!=null">
when ID=#{i.id} then #{i.empIdcard}
</if>
</foreach>
</trim>
<trim prefix="PROJECT_STATUS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then 0
</foreach>
</trim>
<trim prefix="UPDATE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
</foreach>
</trim>
<trim prefix="UPDATE_BY =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.updateBy!=null">
when ID=#{i.id} then #{i.updateBy}
</if>
</foreach>
</trim>
<trim prefix="DEPT_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.deptNo!=null">
when ID=#{i.id} then #{i.deptNo}
</if>
</foreach>
</trim>
<trim prefix="CONTRACT_TYPE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.contractType!=null">
when ID=#{i.id} then #{i.contractType}
</if>
</foreach>
</trim>
<trim prefix="WORKING_HOURS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.workingHours!=null">
when ID=#{i.id} then #{i.workingHours}
</if>
</foreach>
</trim>
<trim prefix="POST =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.post!=null">
when ID=#{i.id} then #{i.post}
</if>
</foreach>
</trim>
<trim prefix="TRY_PERIOD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.tryPeriod!=null">
when ID=#{i.id} then #{i.tryPeriod}
</if>
</foreach>
</trim>
<trim prefix="ENJOIN_DATE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.enjoinDate!=null">
when ID=#{i.id} then #{i.enjoinDate}
</if>
</foreach>
</trim>
<trim prefix="BANK_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankName!=null">
when ID=#{i.id} then #{i.bankName}
</if>
</foreach>
</trim>
<trim prefix="BANK_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankNo!=null">
when ID=#{i.id} then #{i.bankNo}
</if>
</foreach>
</trim>
<trim prefix="BANK_SUB_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankSubName!=null">
when ID=#{i.id} then #{i.bankSubName}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
ID=#{i.id}
</foreach>
</update>
<insert id="insertExcelEmpProject" parameterType="java.util.List">
insert into t_employee_project
(ID,EMP_ID,EMP_NATRUE,EMP_NAME,EMP_IDCARD,STATUS,PROJECT_STATUS,EMP_CODE,DEPT_NO,CONTRACT_TYPE,POST,EMP_NO,
......@@ -301,7 +190,7 @@
</insert>
<!--查询部门编码和最大员工数-->
<select id="findEmployeeMaxOnlyNoByDepId" resultMap="EmployeeNoResultMap">
<select id="findEmployeeMaxOnlyNoByDepId" resultType="java.lang.String">
SELECT
(
SELECT
......
......@@ -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 多一个号码请以逗号分割
......
......@@ -214,4 +214,5 @@ public interface CommonConstants {
* @Date 2020-05-14 14:10
**/
public static final int EMPLOYEE_INIT_NO_START = 7;
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;
}
dapr.upms.appUrl=http://localhost:3500/v1.0/invoke/
dapr.upms.appUrl=http://yifu-upms.qas-mvp.svc.cluster.local:3500/v1.0/invoke/
dapr.upms.appId=yifu-upms
dapr.upms.appPort=4000
dapr.upms.httpPort=3500
......
......@@ -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>
......@@ -17,6 +17,7 @@
package ${package}.${moduleName}.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -55,11 +56,21 @@ public class ${className}Controller {
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R get${className}Page(Page page, ${className} ${classname}) {
//@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R<IPage<${className}>> get${className}Page(Page page, ${className} ${classname}) {
return R.ok(${classname}Service.page(page, Wrappers.query(${classname})));
}
/**
* 不分页查询
* @param ${classname} ${comments}
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@GetMapping("/noPage" )
//@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R<List<${className}>> get${className}NoPage(${className} ${classname}) {
return R.ok(${classname}Service.list(Wrappers.query(${classname})));
}
/**
* 通过id查询${comments}
......@@ -69,7 +80,7 @@ public class ${className}Controller {
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('${moduleName}_${pathName}_get')")
@GetMapping("/{${pk.lowerAttrName}}" )
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_get')" )
public R getById(@PathVariable("${pk.lowerAttrName}" ) ${pk.attrType} ${pk.lowerAttrName}) {
public R<${classname}> getById(@PathVariable("${pk.lowerAttrName}" ) ${pk.attrType} ${pk.lowerAttrName}) {
return R.ok(${classname}Service.getById(${pk.lowerAttrName}));
}
......@@ -82,7 +93,7 @@ public class ${className}Controller {
@SysLog("新增${comments}" )
@PostMapping
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_add')" )
public R save(@RequestBody ${className} ${classname}) {
public R<Boolean> save(@RequestBody ${className} ${classname}) {
return R.ok(${classname}Service.save(${classname}));
}
......@@ -95,7 +106,7 @@ public class ${className}Controller {
@SysLog("修改${comments}" )
@PutMapping
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_edit')" )
public R updateById(@RequestBody ${className} ${classname}) {
public R<Boolean> updateById(@RequestBody ${className} ${classname}) {
return R.ok(${classname}Service.updateById(${classname}));
}
......@@ -108,7 +119,7 @@ public class ${className}Controller {
@SysLog("通过id删除${comments}" )
@DeleteMapping("/{${pk.lowerAttrName}}" )
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_del')" )
public R removeById(@PathVariable ${pk.attrType} ${pk.lowerAttrName}) {
public R<Boolean> removeById(@PathVariable ${pk.attrType} ${pk.lowerAttrName}) {
return R.ok(${classname}Service.removeById(${pk.lowerAttrName}));
}
......
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