17 changed files with 899 additions and 9 deletions
@ -0,0 +1,20 @@ |
|||
package com.elink.esua.epdc.dto.category.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yinzuomei |
|||
* @Date 2019/12/4 10:29 |
|||
*/ |
|||
@Data |
|||
public class CategoryInfoFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -8214790072156444793L; |
|||
|
|||
/** |
|||
* 主键集合 |
|||
*/ |
|||
private Long[] ids; |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package com.elink.esua.epdc.dto.category.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yinzuomei |
|||
* @Date 2019/12/4 9:05 |
|||
*/ |
|||
@Data |
|||
public class CategoryInfoResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 229431634619504645L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private Long id; |
|||
/** |
|||
* 分类名称 |
|||
*/ |
|||
private String categoryName; |
|||
/** |
|||
* 上级分类ID |
|||
*/ |
|||
private Long pid; |
|||
/** |
|||
* 所有上级分类ID,用逗号分开 |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 所有上级分类名称,用逗号分开 |
|||
*/ |
|||
private List<String> parentNames; |
|||
} |
|||
@ -0,0 +1,113 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 项目响应时限 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-02 |
|||
*/ |
|||
@Data |
|||
public class KpiTimeLimitItemDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 有效响应时间(小时数) |
|||
*/ |
|||
private Integer validRespondTime; |
|||
|
|||
/** |
|||
* 有效结案时间(小时数) |
|||
*/ |
|||
private Integer validCloseTime; |
|||
|
|||
/** |
|||
* 项目类别id |
|||
*/ |
|||
private String categoryId; |
|||
|
|||
/** |
|||
* 所有上级项目类别id |
|||
*/ |
|||
private String parentCategoryIds; |
|||
|
|||
/** |
|||
* 所有上级项目类别名称 |
|||
*/ |
|||
private String parentCategoryNames; |
|||
|
|||
/** |
|||
* 所有项目类别id |
|||
*/ |
|||
private String allCategoryIds; |
|||
|
|||
/** |
|||
* 所有项目类别名称 |
|||
*/ |
|||
private String allCategoryNames; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 删除标记 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 项目类别集合 |
|||
*/ |
|||
private List<String> categoryIds; |
|||
|
|||
} |
|||
@ -0,0 +1,93 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.dto.KpiTimeLimitItemDTO; |
|||
import com.elink.esua.epdc.excel.KpiTimeLimitItemExcel; |
|||
import com.elink.esua.epdc.service.KpiTimeLimitItemService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 项目响应时限 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-02 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("kpitimelimititem") |
|||
public class KpiTimeLimitItemController { |
|||
|
|||
@Autowired |
|||
private KpiTimeLimitItemService kpiTimeLimitItemService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<KpiTimeLimitItemDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<KpiTimeLimitItemDTO> page = kpiTimeLimitItemService.page(params); |
|||
return new Result<PageData<KpiTimeLimitItemDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<KpiTimeLimitItemDTO> get(@PathVariable("id") String id){ |
|||
KpiTimeLimitItemDTO data = kpiTimeLimitItemService.get(id); |
|||
return new Result<KpiTimeLimitItemDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody KpiTimeLimitItemDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
return kpiTimeLimitItemService.save(dto); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody KpiTimeLimitItemDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
kpiTimeLimitItemService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
kpiTimeLimitItemService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<KpiTimeLimitItemDTO> list = kpiTimeLimitItemService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, KpiTimeLimitItemExcel.class); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.KpiTimeLimitItemEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 项目响应时限 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-02 |
|||
*/ |
|||
@Mapper |
|||
public interface KpiTimeLimitItemDao extends BaseDao<KpiTimeLimitItemEntity> { |
|||
|
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 项目响应时限 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-02 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_kpi_time_limit_item") |
|||
public class KpiTimeLimitItemEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 有效响应时间(小时数) |
|||
*/ |
|||
private Integer validRespondTime; |
|||
|
|||
/** |
|||
* 有效结案时间(小时数) |
|||
*/ |
|||
private Integer validCloseTime; |
|||
|
|||
/** |
|||
* 项目类别id |
|||
*/ |
|||
private String categoryId; |
|||
|
|||
/** |
|||
* 所有上级项目类别id |
|||
*/ |
|||
private String parentCategoryIds; |
|||
|
|||
/** |
|||
* 所有上级项目类别名称 |
|||
*/ |
|||
private String parentCategoryNames; |
|||
|
|||
/** |
|||
* 所有项目类别id |
|||
*/ |
|||
private String allCategoryIds; |
|||
|
|||
/** |
|||
* 所有项目类别名称 |
|||
*/ |
|||
private String allCategoryNames; |
|||
|
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 项目响应时限 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-02 |
|||
*/ |
|||
@Data |
|||
public class KpiTimeLimitItemExcel { |
|||
|
|||
@Excel(name = "主键") |
|||
private String id; |
|||
|
|||
@Excel(name = "有效响应时间(小时数)") |
|||
private Integer validRespondTime; |
|||
|
|||
@Excel(name = "有效结案时间(小时数)") |
|||
private Integer validCloseTime; |
|||
|
|||
@Excel(name = "项目类别id") |
|||
private String categoryId; |
|||
|
|||
@Excel(name = "所有上级项目类别id") |
|||
private String parentCategoryIds; |
|||
|
|||
@Excel(name = "所有上级项目类别名称") |
|||
private String parentCategoryNames; |
|||
|
|||
@Excel(name = "所有项目类别id") |
|||
private String allCategoryIds; |
|||
|
|||
@Excel(name = "所有项目类别名称") |
|||
private String allCategoryNames; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
@Excel(name = "删除标记") |
|||
private String delFlag; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
package com.elink.esua.epdc.feign; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.category.form.CategoryInfoFormDTO; |
|||
import com.elink.esua.epdc.dto.category.result.CategoryInfoResultDTO; |
|||
import com.elink.esua.epdc.feign.fallback.EventFeignClientFallback; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Auther: yinzuomei |
|||
* @Date: 2019/12/4 09:28 |
|||
* @Description: 事件接口 |
|||
*/ |
|||
@FeignClient(name = ServiceConstant.EPDC_EVENTS_SERVER, fallback = EventFeignClientFallback.class,url = "http://127.0.0.1:9066") |
|||
public interface EventFeignClient { |
|||
|
|||
/** |
|||
* @param categoryInfoFormDTO |
|||
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.category.result.CategoryInfoResultDTO>> |
|||
* @Author yinzuomei |
|||
* @Description 根据id查询事件分类基本信息 |
|||
* @Date 2019/12/4 10:37 |
|||
**/ |
|||
@PostMapping(value = "events/category/queryCategoryInfo", consumes = MediaType.APPLICATION_JSON_VALUE) |
|||
Result<List<CategoryInfoResultDTO>> queryCategoryInfo(CategoryInfoFormDTO categoryInfoFormDTO); |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.elink.esua.epdc.feign.fallback; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.category.form.CategoryInfoFormDTO; |
|||
import com.elink.esua.epdc.dto.category.result.CategoryInfoResultDTO; |
|||
import com.elink.esua.epdc.feign.EventFeignClient; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @Author yinzuomei |
|||
* @Date 2019/12/4 9:45 |
|||
*/ |
|||
@Component |
|||
public class EventFeignClientFallback implements EventFeignClient { |
|||
|
|||
@Override |
|||
public Result<List<CategoryInfoResultDTO>> queryCategoryInfo(CategoryInfoFormDTO categoryInfoFormDTO) { |
|||
return ModuleUtils.feignConError(ServiceConstant.EPDC_EVENTS_SERVER, "queryCategoryInfo", categoryInfoFormDTO); |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 项目响应时限 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-02 |
|||
*/ |
|||
@Component |
|||
public class KpiTimeLimitItemRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dto.KpiTimeLimitItemDTO; |
|||
import com.elink.esua.epdc.entity.KpiTimeLimitItemEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 项目响应时限 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-02 |
|||
*/ |
|||
public interface KpiTimeLimitItemService extends BaseService<KpiTimeLimitItemEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<KpiTimeLimitItemDTO> |
|||
* @author generator |
|||
* @date 2019-12-02 |
|||
*/ |
|||
PageData<KpiTimeLimitItemDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<KpiTimeLimitItemDTO> |
|||
* @author generator |
|||
* @date 2019-12-02 |
|||
*/ |
|||
List<KpiTimeLimitItemDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return KpiTimeLimitItemDTO |
|||
* @author generator |
|||
* @date 2019-12-02 |
|||
*/ |
|||
KpiTimeLimitItemDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-12-02 |
|||
*/ |
|||
Result save(KpiTimeLimitItemDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-12-02 |
|||
*/ |
|||
void update(KpiTimeLimitItemDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2019-12-02 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
|||
@ -0,0 +1,156 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import cn.hutool.core.collection.CollUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.dao.KpiTimeLimitItemDao; |
|||
import com.elink.esua.epdc.dto.KpiTimeLimitItemDTO; |
|||
import com.elink.esua.epdc.dto.category.form.CategoryInfoFormDTO; |
|||
import com.elink.esua.epdc.dto.category.result.CategoryInfoResultDTO; |
|||
import com.elink.esua.epdc.entity.KpiTimeLimitItemEntity; |
|||
import com.elink.esua.epdc.feign.EventFeignClient; |
|||
import com.elink.esua.epdc.redis.KpiTimeLimitItemRedis; |
|||
import com.elink.esua.epdc.service.KpiTimeLimitItemService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.io.File; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 项目响应时限 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2019-12-02 |
|||
*/ |
|||
@Service |
|||
public class KpiTimeLimitItemServiceImpl extends BaseServiceImpl<KpiTimeLimitItemDao, KpiTimeLimitItemEntity> implements KpiTimeLimitItemService { |
|||
|
|||
private Logger logger = LoggerFactory.getLogger(getClass()); |
|||
@Autowired |
|||
private KpiTimeLimitItemRedis kpiTimeLimitItemRedis; |
|||
|
|||
@Autowired |
|||
private EventFeignClient eventFeignClient; |
|||
|
|||
@Override |
|||
public PageData<KpiTimeLimitItemDTO> page(Map<String, Object> params) { |
|||
String categoryId = params.containsKey("categoryId") ? params.get("categoryId").toString() : null; |
|||
QueryWrapper<KpiTimeLimitItemEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(categoryId), "CATEGORY_ID", categoryId); |
|||
IPage<KpiTimeLimitItemEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
wrapper |
|||
); |
|||
return getPageData(page, KpiTimeLimitItemDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<KpiTimeLimitItemDTO> list(Map<String, Object> params) { |
|||
List<KpiTimeLimitItemEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, KpiTimeLimitItemDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<KpiTimeLimitItemEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<KpiTimeLimitItemEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public KpiTimeLimitItemDTO get(String id) { |
|||
KpiTimeLimitItemEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, KpiTimeLimitItemDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public Result save(KpiTimeLimitItemDTO dto) { |
|||
for (String categoryIds : dto.getCategoryIds()) { |
|||
categoryIds = categoryIds.replaceAll("\\[", "").replaceAll("\\]", "").replace("\"", ""); |
|||
String[] categoryIdArray = categoryIds.split(","); |
|||
String categoryId = categoryIdArray[categoryIdArray.length - 1]; |
|||
CategoryInfoFormDTO categoryInfoFormDTO = new CategoryInfoFormDTO(); |
|||
Long[] ids = new Long[1]; |
|||
ids[0] = Long.valueOf(categoryId); |
|||
categoryInfoFormDTO.setIds(ids); |
|||
Result<List<CategoryInfoResultDTO>> res = eventFeignClient.queryCategoryInfo(categoryInfoFormDTO); |
|||
if (res.getCode() != 0 || CollUtil.isEmpty(res.getData()) || res.getData().size() == 0) { |
|||
return new Result().error("查询分类详情失败" + res.getMsg()); |
|||
} |
|||
String allCategoryNames = ""; |
|||
String parentCategoryIds = ""; |
|||
String parentCategoryNames = ""; |
|||
CategoryInfoResultDTO categoryInfoResultDTO = res.getData().get(0); |
|||
for (String parentName : categoryInfoResultDTO.getParentNames()) { |
|||
parentCategoryNames += (parentName + "-"); |
|||
} |
|||
//去除最后一个-
|
|||
parentCategoryNames = parentCategoryNames.substring(0, parentCategoryNames.length() - 1); |
|||
allCategoryNames = parentCategoryNames + "-" + categoryInfoResultDTO.getCategoryName(); |
|||
int index = categoryIds.lastIndexOf(","); |
|||
// logger.info("最后一个逗号所在的位置"+index);
|
|||
parentCategoryIds = categoryIds.substring(0, index); |
|||
dto.setCategoryId(categoryId); |
|||
dto.setAllCategoryIds(categoryIds); |
|||
dto.setAllCategoryNames(allCategoryNames); |
|||
dto.setParentCategoryIds(parentCategoryIds); |
|||
dto.setParentCategoryNames(parentCategoryNames); |
|||
KpiTimeLimitItemEntity entity = ConvertUtils.sourceToTarget(dto, KpiTimeLimitItemEntity.class); |
|||
// 删除已存在的记录
|
|||
QueryWrapper<KpiTimeLimitItemEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(categoryId), "CATEGORY_ID", categoryId); |
|||
baseDao.delete(wrapper); |
|||
//插入
|
|||
insert(entity); |
|||
} |
|||
return new Result(); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(KpiTimeLimitItemDTO dto) { |
|||
KpiTimeLimitItemEntity entity = ConvertUtils.sourceToTarget(dto, KpiTimeLimitItemEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.elink.esua.epdc.dao.KpiTimeLimitItemDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.entity.KpiTimeLimitItemEntity" id="kpiTimeLimitItemMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="validRespondTime" column="VALID_RESPOND_TIME"/> |
|||
<result property="validCloseTime" column="VALID_CLOSE_TIME"/> |
|||
<result property="categoryId" column="CATEGORY_ID"/> |
|||
<result property="parentCategoryIds" column="PARENT_CATEGORY_IDS"/> |
|||
<result property="parentCategoryNames" column="PARENT_CATEGORY_NAMES"/> |
|||
<result property="allCategoryIds" column="ALL_CATEGORY_IDS"/> |
|||
<result property="allCategoryNames" column="ALL_CATEGORY_NAMES"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue