[功能]1. 项目重命名, 2. 取消预约功能添加

master
liuqingkun 3 years ago
parent 0ce02c98f5
commit 612a325af8
  1. 1
      src/main/java/org/springblade/common/constant/BusinessConstant.java
  2. 11
      src/main/java/org/springblade/modules/business/controller/ApmConfigController.java
  3. 2
      src/main/java/org/springblade/modules/business/mapper/ApmRecordMapper.java
  4. 13
      src/main/java/org/springblade/modules/business/mapper/ApmRecordMapper.xml
  5. 8
      src/main/java/org/springblade/modules/business/service/IApmConfigService.java
  6. 19
      src/main/java/org/springblade/modules/business/service/impl/ApmConfigServiceImpl.java
  7. 17
      src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
  8. 2
      src/main/java/org/springblade/modules/system/wrapper/UserWrapper.java

@ -34,6 +34,7 @@ public interface BusinessConstant {
/**
* 放号设置返回map的key
*/
String MAP_KEY_APM_CONFIG_LIST_ID = "id"; // id
String MAP_KEY_APM_CONFIG_LIST_PERIOD = "period"; // 时段
String MAP_KEY_APM_CONFIG_LIST_TIME_FRAME = "timeFrame"; // 时间范围
String MAP_KEY_APM_CONFIG_LIST_NUMBER_NUM = "numberNum"; // 放号数量

@ -2,6 +2,7 @@ package org.springblade.modules.business.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.common.constant.BusinessConstant;
@ -157,4 +158,14 @@ public class ApmConfigController extends BladeController {
return R.fail(msg);
}
}
/**
* 取消放号
*/
@PostMapping("/cancel")
public R cancel(@ApiParam(value = "主键集合") @RequestParam String ids) {
String msg = apmConfigService.cancel(ids);
return Func.isBlank(msg) ? R.status(true) : R.fail(msg);
}
}

@ -42,4 +42,6 @@ public interface ApmRecordMapper extends BaseMapper<ApmRecord> {
* @return
*/
List<Map<String, Object>> getRenegedCountList();
List<ApmRecord> getByApmConfig(List<Long> idList);
}

@ -176,4 +176,17 @@
) t
GROUP BY cupName, cupCardNo, cupPhone
</select>
<select id="getByApmConfig" resultMap="apmRecordResultMap">
SELECT r.*
FROM ca_apm_record r
LEFT JOIN ca_apm_config c ON r.create_dept = c.create_dept AND r.apm_day = c.apm_day AND r.project = c.project AND r.period = c.period AND r.time_frame = c.time_frame
where r.is_deleted = false and c.is_deleted = false
<if test="idList != null">
and c.id in
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=", ">
#{id}
</foreach>
</if>
</select>
</mapper>

@ -59,4 +59,12 @@ public interface IApmConfigService extends IService<ApmConfig> {
String saveCheck(Long createDept, List<String> dayList, List<ApmConfigListVO> configListVOS);
void saveApmConfig(Long createDept, List<String> dayList, List<ApmConfigListVO> configListVOS);
/**
* 取消放号
*
* @param ids
* @return 成功返回null, 失败返回具体错误信息
*/
String cancel(String ids);
}

@ -12,10 +12,7 @@ import org.springblade.common.constant.BusinessConstant;
import org.springblade.common.utils.CommonDateUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.core.tool.utils.*;
import org.springblade.modules.business.dto.ApmRecordCountDTO;
import org.springblade.modules.business.entity.ApmConfig;
import org.springblade.modules.business.entity.ApmRecord;
@ -158,6 +155,7 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig
List<Map<String, Object>> detailList = new ArrayList<>();
for (ApmConfig config : configList) {
Map<String, Object> detail = new HashMap<>();
detail.put(BusinessConstant.MAP_KEY_APM_CONFIG_LIST_ID, config.getId());
detail.put(BusinessConstant.MAP_KEY_APM_CONFIG_LIST_PERIOD, config.getPeriod());
detail.put(BusinessConstant.MAP_KEY_APM_CONFIG_LIST_TIME_FRAME, config.getTimeFrame());
detail.put(BusinessConstant.MAP_KEY_APM_CONFIG_LIST_NUMBER_NUM, config.getNumberNum());
@ -377,6 +375,19 @@ public class ApmConfigServiceImpl extends ServiceImpl<ApmConfigMapper, ApmConfig
saveBatch(configList);
}
@Override
public String cancel(String ids) {
// 1. 先验证要取消的放号是否已有预约, 若有预约, 不允许取消
List<ApmRecord> records = recordMapper.getByApmConfig(Func.toLongList(ids));
if (Func.isNotEmpty(records)) {
return "本次放号设置已有预约, 无法取消!";
}
// 2. 按照ids, 将放号记录标记删除
baseMapper.deleteBatchIds(Func.toLongList(ids));
return null;
}
private void deleteConfig(Long createDept, List<String> apmDayList, List<String> projectList) {
String apmDayStr = "('" + String.join("', '", apmDayList) + "')";
String projectStr = "('" + String.join("', '", projectList) + "')";

@ -83,19 +83,6 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
user.setTenantId(BladeConstant.ADMIN_TENANT_ID);
}
String tenantId = user.getTenantId();
Tenant tenant = SysCache.getTenant(tenantId);
if (Func.isNotEmpty(tenant)) {
Integer accountNumber = tenant.getAccountNumber();
if (tenantProperties.getLicense()) {
String licenseKey = tenant.getLicenseKey();
String decrypt = DesUtil.decryptFormHex(licenseKey, TenantConstant.DES_KEY);
accountNumber = JsonUtil.parse(decrypt, Tenant.class).getAccountNumber();
}
Long tenantCount = baseMapper.selectCount(Wrappers.<User>query().lambda().eq(User::getTenantId, tenantId));
if (accountNumber != null && accountNumber > 0 && accountNumber <= tenantCount) {
throw new ServiceException("当前租户已到最大账号额度!");
}
}
if (Func.isNotEmpty(user.getPassword())) {
user.setPassword(DigestUtil.encrypt(user.getPassword()));
}
@ -350,10 +337,6 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
@Override
@Transactional(rollbackFor = Exception.class)
public boolean registerGuest(User user, Long oauthId) {
Tenant tenant = SysCache.getTenant(user.getTenantId());
if (tenant == null || tenant.getId() == null) {
throw new ServiceException("租户信息错误!");
}
UserOauth userOauth = userOauthService.getById(oauthId);
if (userOauth == null || userOauth.getId() == null) {
throw new ServiceException("第三方登陆信息错误!");

@ -43,11 +43,9 @@ public class UserWrapper extends BaseEntityWrapper<User, UserVO> {
@Override
public UserVO entityVO(User user) {
UserVO userVO = Objects.requireNonNull(BeanUtil.copy(user, UserVO.class));
Tenant tenant = SysCache.getTenant(user.getTenantId());
List<String> roleName = SysCache.getRoleNames(user.getRoleId());
List<String> deptName = SysCache.getDeptNames(user.getDeptId());
List<String> postName = SysCache.getPostNames(user.getPostId());
userVO.setTenantName(tenant.getTenantName());
userVO.setRoleName(Func.join(roleName));
userVO.setDeptName(Func.join(deptName));
userVO.setPostName(Func.join(postName));

Loading…
Cancel
Save