Browse Source

定制服务-修改接口,调整

master
zhangyongzhangyong 5 years ago
parent
commit
db627afd0d
  1. 6
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java
  2. 10
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java
  3. 62
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java
  4. 27
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml

6
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomizedFormDTO.java

@ -33,12 +33,6 @@ public class UpdateCustomizedFormDTO implements Serializable {
@NotBlank(message = "功能说明不能为空")
private String functionExplain;
/**
* 定制功能详情ID
*/
@NotBlank(message = "定制功能详情ID不能为空")
private String customizedId;
/**
* 默认名称
*/

10
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java

@ -88,4 +88,14 @@ public interface FunctionCustomizedDao extends BaseDao<FunctionCustomizedEntity>
* @Date 10:10 2020-08-14
**/
Integer countTotalFunctionCustomizedList(FunctionCustomizedListFormDTO formDTO);
/**
* 根据功能id修改定制功能表
*
* @param entity
* @return void
* @Author zhangyong
* @Date 13:26 2020-08-14
**/
void updateFunctionCustomized(FunctionCustomizedEntity entity);
}

62
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedServiceImpl.java

@ -193,7 +193,7 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto
|| !formDTO.getDomainName().equals(customizedDTO.getDomainName())
|| !formDTO.getFromApp().equals(customizedDTO.getFromApp()) ){
// 如果修改的内容是其他字段,则返回语句
tipCustomizedInfoUserId.append(customizedId.get(i).getId());
tipCustomizedInfoUserId.append(customizedId.get(i).getId() + ",");
} else if (!formDTO.getCustomizedName().equals(customizedDTO.getCustomizedName())
|| !formDTO.getIconLargeImg().equals(customizedDTO.getIconLargeImg())
|| !formDTO.getIconSmallImg().equals(customizedDTO.getIconSmallImg())){
@ -212,30 +212,17 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto
// 1.修改 客户定制功能详情表
if (upCustomizedInfo != null && upCustomizedInfo.size() > NumConstant.ZERO){
customerFunctionDetailService.updateBatchById(upCustomizedInfo);
// 2.客户正在使用该功能,根据入参参数,修改功能表、定制功能表
this.functionInUse(formDTO);
}
// 2.修改 功能表, 修改的字段范围,是:功能名称和大小图标
this.upFunction(formDTO, NumConstant.ZERO);
// 3.修改 定制功能表, 修改的字段范围,是:功能名称和大小图标
FunctionCustomizedEntity entity = new FunctionCustomizedEntity();
entity.setId(formDTO.getCustomizedId());
entity.setCustomizedName(formDTO.getCustomizedName());
entity.setIconLargeImg(formDTO.getIconLargeImg());
entity.setIconSmallImg(formDTO.getIconSmallImg());
baseDao.updateById(entity);
// 4.提示哪些用户不能被修改
// 3.提示哪些用户不能被修改
if (tipCustomizedInfoUserId != null && tipCustomizedInfoUserId.length() >NumConstant.ZERO){
return new Result<>().error(8000, "客户正在使用该功能不允许修改上下架状态、业务域名和外链地址、所属端app!");
return new Result<>().error(8000, "客户"+ tipCustomizedInfoUserId +"正在使用该功能不允许修改上下架状态、业务域名和外链地址、所属端app!");
}
} else {
// 没有客户正在使用该 功能
// 2.修改 功能表, 修改的字段范围,是所有入参字段
this.upFunction(formDTO, NumConstant.ONE);
// 3.修改 定制功能表, 修改的字段范围,是所有入参字段
FunctionCustomizedEntity entity = ConvertUtils.sourceToTarget(formDTO, FunctionCustomizedEntity.class);
entity.setId(formDTO.getCustomizedId());
baseDao.updateById(entity);
// 1. 没有客户使用该 功能,根据入参参数,修改功能表、定制功能表
this.functionNotUsed(formDTO);
}
return new Result();
}
@ -287,4 +274,39 @@ public class FunctionCustomizedServiceImpl extends BaseServiceImpl<FunctionCusto
}
functionService.updateById(entity);
}
/**
* 客户未使用该功能根据入参参数修改功能表定制功能表
* @param formDTO
* @return void
* @Author zhangyong
* @Date 11:08 2020-08-14
**/
private void functionNotUsed(UpdateCustomizedFormDTO formDTO){
// 1.修改 功能表, 修改的字段范围,是所有入参字段
this.upFunction(formDTO, NumConstant.ONE);
// 2.修改 定制功能表, 修改的字段范围,是所有入参字段
FunctionCustomizedEntity entity = ConvertUtils.sourceToTarget(formDTO, FunctionCustomizedEntity.class);
baseDao.updateFunctionCustomized(entity);
}
/**
* 客户正在使用该功能根据入参参数修改功能表定制功能表
* @param formDTO
* @return void
* @Author zhangyong
* @Date 14:00 2020-08-14
**/
private void functionInUse(UpdateCustomizedFormDTO formDTO){
// 1.修改 功能表, 修改的字段范围,是:功能名称和大小图标
this.upFunction(formDTO, NumConstant.ZERO);
// 2.修改 定制功能表, 修改的字段范围,是:功能名称和大小图标
FunctionCustomizedEntity entity = new FunctionCustomizedEntity();
entity.setFunctionId(formDTO.getFunctionId());
entity.setCustomizedName(formDTO.getCustomizedName());
entity.setIconLargeImg(formDTO.getIconLargeImg());
entity.setIconSmallImg(formDTO.getIconSmallImg());
baseDao.updateFunctionCustomized(entity);
}
}

27
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml

@ -88,4 +88,31 @@
AND cu.FROM_APP = 'gov'
</if>
</select>
<update id="updateFunctionCustomized" parameterType="com.epmet.entity.FunctionCustomizedEntity">
UPDATE function_customized
SET
<if test="customizedName != null and customizedName.trim() != ''">
CUSTOMIZED_NAME = #{customizedName},
</if>
<if test="iconLargeImg != null and iconLargeImg.trim() != ''">
ICON_LARGE_IMG = #{iconLargeImg},
</if>
<if test="iconSmallImg != null and iconSmallImg.trim() != ''">
ICON_SMALL_IMG = #{iconSmallImg},
</if>
<if test="targetLink != null and targetLink.trim() != ''">
TARGET_LINK = #{targetLink},
</if>
<if test="domainName != null and domainName.trim() != ''">
DOMAIN_NAME = #{domainName},
</if>
<if test="fromApp != null and fromApp.trim() != ''">
FROM_APP = #{fromApp},
</if>
UPDATED_TIME = now()
WHERE
DEL_FLAG = '0'
AND FUNCTION_ID = #{functionId}
</update>
</mapper>

Loading…
Cancel
Save