1
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
package com.mosty.rwzx;
|
||||
|
||||
import com.mosty.common.base.timeconsume.EnableTimeConsume;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 任务中心 微服务
|
||||
* @author zengbo
|
||||
* @date 2022/7/11 14:29 PM[
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@EnableTimeConsume
|
||||
//@ComponentScan("com.mosty")
|
||||
@EnableFeignClients(basePackages = "com.mosty.base.feign.service")
|
||||
@MapperScan("com.mosty.rwzx.mapper")
|
||||
@EnableDiscoveryClient
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
public class MostyRwzxApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(MostyRwzxApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.mosty.rwzx.config;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Configuration
|
||||
public class FeignConfig implements RequestInterceptor {
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate requestTemplate) {
|
||||
ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attr != null) {
|
||||
HttpServletRequest request = attr.getRequest();
|
||||
// 添加token
|
||||
requestTemplate.header("Authorization", request.getHeader("Authorization"));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.mosty.rwzx.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 全局配置
|
||||
* @author kevin
|
||||
* @date 2022/5/25 1:56 上午
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties("exclude.path-patterns")
|
||||
public class GlobalYmlConfig {
|
||||
|
||||
/**
|
||||
* swagger 静态文件的放行列表
|
||||
*/
|
||||
private List<String> swagger;
|
||||
|
||||
}
|
120
mosty-rwzx/src/main/java/com/mosty/rwzx/config/WebMvcConfig.java
Normal file
120
mosty-rwzx/src/main/java/com/mosty/rwzx/config/WebMvcConfig.java
Normal file
@ -0,0 +1,120 @@
|
||||
package com.mosty.rwzx.config;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
import com.mosty.common.token.SysUserInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 单体服务拦截器
|
||||
* @author kevin
|
||||
* @date 2022/3/21 11:17 PM
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class WebMvcConfig implements WebMvcConfigurer, InitializingBean {
|
||||
|
||||
private static final String DEFAULT_TIME_FORMAT = "HH:mm:ss";
|
||||
private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
|
||||
private static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
@Value("${server.servlet.context-path:/}")
|
||||
private String contextPath;
|
||||
|
||||
@Autowired
|
||||
private GlobalYmlConfig globalYmlConfig;
|
||||
|
||||
@Override
|
||||
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
|
||||
ObjectMapper objectMapper = converter.getObjectMapper();
|
||||
// 生成JSON时,将所有Long转换成String
|
||||
SimpleModule simpleModule = new SimpleModule();
|
||||
//日期格式化
|
||||
simpleModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)));
|
||||
simpleModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)));
|
||||
simpleModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)));
|
||||
simpleModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_TIME_FORMAT)));
|
||||
simpleModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT)));
|
||||
simpleModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern(DEFAULT_TIME_FORMAT)));
|
||||
objectMapper.registerModule(simpleModule);
|
||||
// 时间格式化
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
|
||||
objectMapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true);
|
||||
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
// 设置格式化内容
|
||||
converter.setObjectMapper(objectMapper);
|
||||
converters.add(0, converter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
log.info("当前服务的 contextPath={}", contextPath);
|
||||
log.info("当前服务的 swaggerExcludePathPatterns={}", JSON.toJSONString(globalYmlConfig.getSwagger()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||
configurer.defaultContentType(MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(userInfoInterceptor()).addPathPatterns("/**")
|
||||
.excludePathPatterns(globalYmlConfig.getSwagger());
|
||||
log.info("初始化WebMvcConfig 监控拦截器SysUserInterceptor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
if (!registry.hasMappingForPattern("/template/**")) {
|
||||
registry.addResourceHandler("/template/**").addResourceLocations("classpath:/template/");
|
||||
}
|
||||
registry.addResourceHandler("swagger-ui.html")
|
||||
.addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("docs.html")
|
||||
.addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
WebMvcConfigurer.super.addResourceHandlers(registry);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SysUserInterceptor userInfoInterceptor() {
|
||||
log.info("初始化WebMvcConfig 拦截器SysUserInterceptor");
|
||||
return new SysUserInterceptor();
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.mosty.rwzx.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.mosty.base.model.dto.rwzx.*;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTask;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskLogQuery;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskMyQuery;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskQuery;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskUserQuery;
|
||||
import com.mosty.base.model.vo.rwzx.*;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.entity.log.BusinessType;
|
||||
import com.mosty.common.base.entity.log.Log;
|
||||
import com.mosty.common.token.JwtSysUser;
|
||||
import com.mosty.rwzx.service.TbRwTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/9/19
|
||||
**/
|
||||
@Api(tags = "任务中心相关接口-外部调用接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/tbRwTask")
|
||||
public class TbRwTaskController {
|
||||
|
||||
private final TbRwTaskService tbRwTaskService;
|
||||
|
||||
@ApiOperation("添加任务信息")
|
||||
@PostMapping("addRw")
|
||||
public ResponseResult<Integer> addRw(@RequestBody TbRwTaskDto dto) {
|
||||
return ResponseResult.success(this.tbRwTaskService.addRw(dto));
|
||||
}
|
||||
}
|
@ -0,0 +1,201 @@
|
||||
package com.mosty.rwzx.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.mosty.base.model.dto.rwzx.*;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTask;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUser;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUserAll;
|
||||
import com.mosty.base.model.entity.yjzl.TbZlxx;
|
||||
import com.mosty.base.model.query.rwzx.*;
|
||||
import com.mosty.base.model.vo.rwzx.*;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.entity.log.BusinessType;
|
||||
import com.mosty.common.base.entity.log.Log;
|
||||
import com.mosty.common.token.JwtSysUser;
|
||||
import com.mosty.rwzx.service.TbRwTaskInnerService;
|
||||
import com.mosty.rwzx.service.TbRwTaskService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/9/19
|
||||
**/
|
||||
@Api(tags = "任务中心相关接口--内部接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/tbRwTask/inner")
|
||||
public class TbRwTaskInnerController {
|
||||
|
||||
private final TbRwTaskInnerService tbRwTaskInnerService;
|
||||
private final TbRwTaskService tbRwTaskService;
|
||||
|
||||
@ApiOperation("添加任务信息")
|
||||
@JwtSysUser
|
||||
@PostMapping("addRw")
|
||||
@Log(title = "添加任务信息", businessType = BusinessType.INSERT)
|
||||
public ResponseResult<Integer> addRw(@RequestBody TbRwTaskInnerDto dto) {
|
||||
return ResponseResult.success(this.tbRwTaskInnerService.addRw(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务列表")
|
||||
@JwtSysUser
|
||||
@GetMapping("selectPage")
|
||||
public ResponseResult<IPage<TbRwTaskVo>> selectPage(TbRwTaskInnerQuery dto) {
|
||||
return ResponseResult.success(this.tbRwTaskInnerService.selectPage(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("APP统计我的任务数量")
|
||||
@JwtSysUser
|
||||
@GetMapping("myRwCount")
|
||||
public ResponseResult<List<Map<String, Object>>> myRwCount() {
|
||||
return ResponseResult.success(this.tbRwTaskInnerService.myRwCount());
|
||||
}
|
||||
|
||||
@ApiOperation("APP统计任务列表的数量")
|
||||
@JwtSysUser
|
||||
@GetMapping("rwCountByState")
|
||||
public ResponseResult<List<Map<String, Object>>> rwCountByState(TbRwTaskInnerQuery dto) {
|
||||
return ResponseResult.success(this.tbRwTaskInnerService.rwCountByState(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("查询我的任务列表")
|
||||
@JwtSysUser
|
||||
@GetMapping("selectMyPage")
|
||||
public ResponseResult<IPage<TbRwTaskUser>> selectMyPage(TbRwTaskMyInnerQuery dto) {
|
||||
return ResponseResult.success(this.tbRwTaskInnerService.selectMyPage(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("通过任务Id查询任务详情信息")
|
||||
@JwtSysUser
|
||||
@GetMapping("getTaskInfo/{id}")
|
||||
public ResponseResult<TbRwTaskVo> getTaskInfo(@PathVariable("id") String id) {
|
||||
return ResponseResult.success(this.tbRwTaskService.getTaskInfo(id));
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务是否是登录人的任务")
|
||||
@JwtSysUser
|
||||
@GetMapping("checkMyTask/{id}")
|
||||
public ResponseResult<Boolean> checkMyTask(@PathVariable("id") String id) {
|
||||
return ResponseResult.success(this.tbRwTaskService.checkMyTask(id));
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务接收人列表")
|
||||
@JwtSysUser
|
||||
@GetMapping("getTaskUserList")
|
||||
public ResponseResult<IPage<TbRwTaskUserVo>> getTaskUserList(TbRwTaskUserQuery dto) {
|
||||
return ResponseResult.success(this.tbRwTaskService.getTaskUserList(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务日志列表")
|
||||
@JwtSysUser
|
||||
@GetMapping("getTaskLogList")
|
||||
public ResponseResult<IPage<TbRwTaskLogVo>> getTaskLogList(TbRwTaskLogQuery dto) {
|
||||
return ResponseResult.success(this.tbRwTaskService.getTaskLogList(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("修改个人任务状态")
|
||||
@JwtSysUser
|
||||
@PostMapping("changeGrrwState")
|
||||
@Log(title = "修改个人任务状态", businessType = BusinessType.UPDATE)
|
||||
public ResponseResult<Void> changeGrrwState(@RequestBody TbRwTaskGrChangeStateInnerDto dto) {
|
||||
this.tbRwTaskInnerService.changeGrrwState(dto);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("根据任务ID修改任务状态")
|
||||
@JwtSysUser
|
||||
@PostMapping("changeRwState")
|
||||
@Log(title = "修改任务状态", businessType = BusinessType.UPDATE)
|
||||
public ResponseResult<Void> changeRwState(@RequestBody TbRwTaskChangeStateInnerDto dto) {
|
||||
this.tbRwTaskInnerService.changeRwState(dto);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("根据业务ID和业务类型修改任务状态")
|
||||
@JwtSysUser
|
||||
@PostMapping("changeStateByYwid")
|
||||
@Log(title = "根据业务ID和业务类型修改任务状态", businessType = BusinessType.UPDATE)
|
||||
public ResponseResult<Void> changeStateByYwid(@RequestBody TbRwTaskChangeStateByYwidDto dto) {
|
||||
this.tbRwTaskInnerService.changeStateByYwid(dto);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("任务中心首页数量统计接口")
|
||||
@JwtSysUser
|
||||
@GetMapping("getDataStatistics")
|
||||
public ResponseResult<TbRwTaskStatisticsVo> getDataStatistics(TbRwTaskStatisticsDto dto) {
|
||||
return ResponseResult.success(this.tbRwTaskService.getDataStatistics(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("任务中心首页任务类型数量统计接口")
|
||||
@JwtSysUser
|
||||
@GetMapping("getRWLXDataStatistics")
|
||||
@Log(title = "任务中心首页任务类型数量统计接口", businessType = BusinessType.OTHER)
|
||||
public ResponseResult<List<TbRwTaskLXStatisticsVo>> getRWLXDataStatistics(TbRwTaskStatisticsDto dto) {
|
||||
return ResponseResult.success(this.tbRwTaskService.getRWLXDataStatistics(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("任务中心首页人员任务完成情况排名接口")
|
||||
@JwtSysUser
|
||||
@GetMapping("getTaskRanking")
|
||||
public ResponseResult<List<TbRwTaskRankingVo>> getTaskRanking(TbRwTaskStatisticsDto dto) {
|
||||
return ResponseResult.success(this.tbRwTaskService.getTaskRanking(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("任务中心首页部门任务完成情况排名接口")
|
||||
@JwtSysUser
|
||||
@GetMapping("getTaskByDept")
|
||||
public ResponseResult<List<TbRwTaskRankingVo>> getTaskByDept() {
|
||||
return ResponseResult.success(this.tbRwTaskService.getTaskByDept());
|
||||
}
|
||||
|
||||
@ApiOperation("根据任务类型和业务Id查询任务是否存在")
|
||||
@JwtSysUser
|
||||
@PostMapping("getRwByYwid")
|
||||
public ResponseResult<TbRwTask> getRwByYwid(@RequestBody TbRwTaskByYwidQuery dto) {
|
||||
return ResponseResult.success(this.tbRwTaskService.getRwByYwid(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("检查任务是否过期")
|
||||
@JwtSysUser
|
||||
@PostMapping("changeState")
|
||||
public ResponseResult<Void> changeState() {
|
||||
this.tbRwTaskService.changeState();
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("修改指令任务状态为未完成")
|
||||
@JwtSysUser
|
||||
@PostMapping("changeTaskStateByZlid")
|
||||
public ResponseResult<Void> changeTaskStateByZlid(@RequestBody TbZlxx zl) {
|
||||
this.tbRwTaskService.changeTaskStateByZlid(zl);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("查询登录用户的已处理的任务数量")
|
||||
@JwtSysUser
|
||||
@GetMapping("getYclTask")
|
||||
public ResponseResult<Integer> getYclTask() {
|
||||
return ResponseResult.success(this.tbRwTaskService.getYclTask());
|
||||
}
|
||||
|
||||
@ApiOperation("查询登录用户的已处理的任务列表")
|
||||
@JwtSysUser
|
||||
@PostMapping("getYclTaskList")
|
||||
public ResponseResult<IPage<TbRwTaskUserAll>> getYclTaskList(@RequestBody TbRwTaskMyInnerQuery dto) {
|
||||
return ResponseResult.success(this.tbRwTaskService.getYclTaskList(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("查询是否有新的任务")
|
||||
@JwtSysUser
|
||||
@GetMapping("checkHasNewTask")
|
||||
public ResponseResult<Boolean> checkHasNewTask(String sfzh) {
|
||||
return ResponseResult.success(this.tbRwTaskService.checkHasNewTask(sfzh));
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.mosty.rwzx.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskLog;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface TbRwTaskLogMapper extends BaseMapper<TbRwTaskLog> {
|
||||
|
||||
@ApiOperation("插入日志")
|
||||
void insertEntity(TbRwTaskLog log);
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.mosty.rwzx.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mosty.base.model.dto.rwzx.TbRwTaskStatisticsDto;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTask;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskLog;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUser;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUserAll;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskInnerQuery;
|
||||
import com.mosty.base.model.vo.base.DeptInfoVo;
|
||||
import com.mosty.base.model.vo.rwzx.TbRwTaskRankingVo;
|
||||
import com.mosty.base.model.vo.rwzx.TbRwTaskVo;
|
||||
import com.mosty.common.config.entity.SysDictItem;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface TbRwTaskMapper extends BaseMapper<TbRwTask> {
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
List<SysDictItem> selectDict(@Param("dictName") String dictName);
|
||||
|
||||
@ApiOperation("排名统计")
|
||||
List<TbRwTaskRankingVo> getTaskRanking(TbRwTaskStatisticsDto dto);
|
||||
|
||||
@ApiOperation("获取我的任务列表")
|
||||
List<TbRwTaskUser> getMyRwList(Map<String, Object> map);
|
||||
|
||||
@ApiOperation("获取我的任务数量")
|
||||
int getMyRwCount(Map<String, Object> map);
|
||||
|
||||
@ApiOperation("根据任务状态查询任务数量")
|
||||
Integer getCount(@Param("rwjxzt") String rwjxzt,
|
||||
@Param("time") Date time,
|
||||
@Param("sfzh") String sfzh);
|
||||
|
||||
@ApiOperation("任务中心首页部门任务完成情况排名接口")
|
||||
List<Map<String, Object>> getTaskByDept();
|
||||
|
||||
@ApiOperation("根据部门查询任务完成情况")
|
||||
int getCountByDept(String ssbmdm, String type);
|
||||
|
||||
@ApiOperation("查询任务数量")
|
||||
List<Map<String, Object>> myRwCount(@Param("sfzh") String sfzh, @Param("ssbmid") String ssbmid);
|
||||
|
||||
@ApiOperation("APP统计任务列表的数量")
|
||||
List<Map<String, Object>> rwCountByState(Map<String, Object> map);
|
||||
|
||||
@ApiOperation("查询登录用户的已处理的任务数量")
|
||||
Integer getYclTask(@Param("sfzh") String sfzh,
|
||||
@Param("ssbmid") String ssbmid);
|
||||
|
||||
@ApiOperation("查询我的任务已完成列表")
|
||||
List<TbRwTaskUserAll> getMyRwListYwc(Map<String, Object> map);
|
||||
|
||||
@ApiOperation("查询我的任务已完成数量")
|
||||
int getMyRwCountYwc(Map<String, Object> map);
|
||||
|
||||
@ApiOperation("查询任务数量")
|
||||
int checkHasNewTask(@Param("sfzh") String sfzh,
|
||||
@Param("ssbmid") String ssbmid,
|
||||
@Param("time") String time);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.mosty.rwzx.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUser;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUserAll;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface TbRwTaskUserAllMapper extends BaseMapper<TbRwTaskUserAll> {
|
||||
|
||||
@ApiOperation("查询我的任务")
|
||||
TbRwTaskUserAll selectByRwId(@Param("sfzh") String idEntityCard,
|
||||
@Param("rwid") String id,
|
||||
@Param("ssbmid") String ssbmid);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.mosty.rwzx.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUser;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TbRwTaskUserMapper extends BaseMapper<TbRwTaskUser> {
|
||||
|
||||
@ApiOperation("查询我的任务")
|
||||
TbRwTaskUser selectByRwId(@Param("sfzh") String idEntityCard,
|
||||
@Param("rwid") String id,
|
||||
@Param("ssbmid") String ssbmid);
|
||||
|
||||
@ApiOperation("删除")
|
||||
void deleteEntity(String id);
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package com.mosty.rwzx.mybatisplus;
|
||||
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import com.mosty.common.base.util.IpUtil;
|
||||
import com.mosty.common.token.UserInfo;
|
||||
import com.mosty.common.token.UserInfoManager;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* MybatisPlus注入处理器
|
||||
*
|
||||
* @author Lhh
|
||||
* @date 2021/4/25
|
||||
*/
|
||||
public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
try {
|
||||
UserInfo userInfo = UserInfoManager.getUser();
|
||||
//根据属性名字设置要填充的值
|
||||
if (metaObject.hasGetter("xtCjip")) {
|
||||
if (metaObject.getValue("xtCjip") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjip", String.class, IpUtil.getIpAddress());
|
||||
}
|
||||
}
|
||||
//根据属性名字设置要填充的值
|
||||
if (metaObject.hasGetter("xtSjzt")) {
|
||||
if (metaObject.getValue("xtSjzt") == null) {
|
||||
this.strictInsertFill(metaObject, "xtSjzt", String.class, "1");
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtScbz")) {
|
||||
if (metaObject.getValue("xtScbz") == null) {
|
||||
this.strictInsertFill(metaObject, "xtScbz", String.class, "0");
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtCjsj")) {
|
||||
if (metaObject.getValue("xtCjsj") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjsj", Timestamp.class, new Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(userInfo)) {
|
||||
if (metaObject.hasGetter("xtCjrId")) {
|
||||
if (metaObject.getValue("xtCjrId") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjrId", String.class, String.valueOf(userInfo.userId));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtCjr")) {
|
||||
if (metaObject.getValue("xtCjr") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjr", String.class, String.valueOf(userInfo.userName));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtCjbmdm")) {
|
||||
if (metaObject.getValue("xtCjbmdm") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjbmdm", String.class, String.valueOf(userInfo.getDeptId()));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtCjbmmc")) {
|
||||
if (metaObject.getValue("xtCjbmmc") == null) {
|
||||
this.strictInsertFill(metaObject, "xtCjbmmc", String.class, userInfo.getDeptName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
try {
|
||||
UserInfo userInfo = UserInfoManager.getUser();
|
||||
if (metaObject.hasGetter("xtZhgxip")) {
|
||||
if (metaObject.getValue("xtZhgxip") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxip", String.class, IpUtil.getIpAddress());
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtZhgxsj")) {
|
||||
if (metaObject.getValue("xtZhgxsj") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxsj", Timestamp.class, new Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
if (Objects.nonNull(userInfo)) {
|
||||
if (metaObject.hasGetter("xtZhgxrid")) {
|
||||
if (metaObject.getValue("xtZhgxrid") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxrid", String.class, String.valueOf(userInfo.userId));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtZhgxr")) {
|
||||
if (metaObject.getValue("xtZhgxr") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxr", String.class, userInfo.userName);
|
||||
}
|
||||
}
|
||||
|
||||
if (metaObject.hasGetter("xtZhgxbmdm")) {
|
||||
if (metaObject.getValue("xtZhgxbmdm") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxbmdm", String.class, String.valueOf(userInfo.getDeptId()));
|
||||
}
|
||||
}
|
||||
if (metaObject.hasGetter("xtZhgxbm")) {
|
||||
if (metaObject.getValue("xtZhgxbm") == null) {
|
||||
this.strictUpdateFill(metaObject, "xtZhgxbm", String.class, userInfo.getDeptName());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException("自动注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.mosty.rwzx.mybatisplus;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* mybatis-plus配置类
|
||||
*
|
||||
* @author Lhh
|
||||
*/
|
||||
@EnableTransactionManagement(proxyTargetClass = true)
|
||||
@Configuration
|
||||
@MapperScan("com.mosty.rwzx.mapper")
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 元对象字段填充控制器
|
||||
* https://baomidou.com/guide/auto-fill-metainfo.html
|
||||
*/
|
||||
@Bean
|
||||
public MetaObjectHandler metaObjectHandler() {
|
||||
return new CreateAndUpdateMetaObjectHandler();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package com.mosty.rwzx.remote;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mosty.base.model.dto.base.GetSsbmDto;
|
||||
import com.mosty.base.model.dto.base.SysDeptDTO;
|
||||
import com.mosty.base.feign.service.MostyBaseFeignService;
|
||||
import com.mosty.base.model.vo.base.DeptInfoVo;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import com.mosty.common.core.business.entity.SysUser;
|
||||
import com.mosty.common.core.business.entity.vo.SysUserDeptVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调用部门信息远程适配层
|
||||
*
|
||||
* @author kevin
|
||||
* @date 2022/7/6 10:37 上午
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TbBaseAdaptRemoteService {
|
||||
|
||||
private final MostyBaseFeignService mostyBaseFeignService;
|
||||
|
||||
// 根据用户ID,获取用户部门信息
|
||||
public DeptInfoVo getDeptInfoByUserId(String userid) {
|
||||
if (StringUtils.isBlank(userid)) {
|
||||
return null;
|
||||
}
|
||||
ResponseResult<DeptInfoVo> responseResult = mostyBaseFeignService.getDeptInfoByUserId(userid);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("获取用户部门信息异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("获取用户部门信息异常");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
|
||||
// 根据部门CODE,获取用户部门信息
|
||||
public DeptInfoVo getOrgByDeptId(String deptcode) {
|
||||
if (StringUtils.isBlank(deptcode)) {
|
||||
return null;
|
||||
}
|
||||
ResponseResult<DeptInfoVo> responseResult = mostyBaseFeignService.getOrgByDeptId(deptcode);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("获取用户部门信息异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("获取用户部门信息异常");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
|
||||
// 查询所有的用户数据(包含对应的部门信息)
|
||||
public List<SysUserDeptVO> getUserAll(String deptid) {
|
||||
if (StringUtils.isBlank(deptid)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
ResponseResult<List<SysUserDeptVO>> responseResult = mostyBaseFeignService.getUserAll(deptid);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("查询所有的用户数据异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("查询所有的用户数据异常");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
|
||||
// 根据部门CODE,获取用户部门信息
|
||||
public DeptInfoVo getOrgByOrgcode(String orgcode) {
|
||||
if (StringUtils.isBlank(orgcode)) {
|
||||
return null;
|
||||
}
|
||||
ResponseResult<DeptInfoVo> responseResult = mostyBaseFeignService.getOrgByOrgcode(orgcode);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("获取用户部门信息异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("获取用户部门信息异常");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
|
||||
// 查询用户详情信息
|
||||
public SysUser getUserInfo(String userId) {
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
return null;
|
||||
}
|
||||
ResponseResult<SysUser> responseResult = mostyBaseFeignService.getUserInfo(userId);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("查询用户详情信息异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("查询用户详情信息异常");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
|
||||
// 查询用户详情信息
|
||||
public SysUser getUserInfoBySfzh(String sfzh) {
|
||||
if (StringUtils.isBlank(sfzh)) {
|
||||
return null;
|
||||
}
|
||||
ResponseResult<SysUser> responseResult = mostyBaseFeignService.getUserInfoBySfzh(sfzh);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("查询用户详情信息异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("查询用户详情信息异常");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
// 获取权限查询条件
|
||||
public String getSsbm(String ssbmdm, String isChild) {
|
||||
GetSsbmDto dto = new GetSsbmDto(ssbmdm, isChild);
|
||||
ResponseResult<String> responseResult = mostyBaseFeignService.getSsbm(dto);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("获取权限查询条件异常 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("获取权限查询条件异常");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.mosty.rwzx.remote;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mosty.base.feign.service.MostyJcglFeignService;
|
||||
import com.mosty.base.feign.service.MostyYszxFeignService;
|
||||
import com.mosty.base.model.vo.jcgl.TbJcglDsfVo;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author dw
|
||||
* @since 2022/7/23
|
||||
* 外部调用基础管理接口
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TbJcglAdaptRemoteService {
|
||||
@Resource
|
||||
private MostyJcglFeignService jcglFeignService;
|
||||
|
||||
public TbJcglDsfVo getDsfInfo(String code){
|
||||
ResponseResult<TbJcglDsfVo> responseResult = jcglFeignService.getDsfInfo(code);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("获取第三方信息失败 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
return null;
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.mosty.rwzx.remote;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mosty.base.feign.service.MostyQwzxFeignService;
|
||||
import com.mosty.base.model.dto.qwzx.TbQwJlDto;
|
||||
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
|
||||
import com.mosty.common.base.domain.ResponseResult;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 勤务中心远程调用
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TbQwzxAdaptRemoteService {
|
||||
|
||||
private final MostyQwzxFeignService mostyQwzxFeignService;
|
||||
|
||||
/**
|
||||
* 获取报备详情
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public TbQwXfbbVo getBbInfo(String id) {
|
||||
ResponseResult<TbQwXfbbVo> responseResult = mostyQwzxFeignService.getBbInfo(id);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("获取报备详情失败 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
return null;
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据报备ID查询巡组下的人员列表
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public List<TbQwJlDto> getJlxxByBbid(String id) {
|
||||
ResponseResult<List<TbQwJlDto>> responseResult = mostyQwzxFeignService.getJlxxByBbid(id);
|
||||
if (responseResult == null || !responseResult.isSuccess()) {
|
||||
log.error("获取报备警力失败 responseResult = {}", JSON.toJSONString(responseResult));
|
||||
throw new BusinessException("获取报备警力列表异常!");
|
||||
}
|
||||
return responseResult.getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,602 @@
|
||||
package com.mosty.rwzx.service.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mosty.base.model.dto.qwzx.TbQwJlDto;
|
||||
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
|
||||
import com.mosty.base.model.dto.rwzx.*;
|
||||
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTask;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskLog;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUser;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUserAll;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskInnerQuery;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskMyInnerQuery;
|
||||
import com.mosty.base.model.vo.base.DeptInfoVo;
|
||||
import com.mosty.base.model.vo.rwzx.TbRwTaskMyVo;
|
||||
import com.mosty.base.model.vo.rwzx.TbRwTaskUserVo;
|
||||
import com.mosty.base.model.vo.rwzx.TbRwTaskVo;
|
||||
import com.mosty.base.utils.*;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import com.mosty.common.core.business.entity.SysUser;
|
||||
import com.mosty.common.core.business.entity.vo.SysUserDeptVO;
|
||||
import com.mosty.common.token.UserInfo;
|
||||
import com.mosty.common.token.UserInfoManager;
|
||||
import com.mosty.common.util.PermissionsUtil;
|
||||
import com.mosty.rwzx.mapper.TbRwTaskLogMapper;
|
||||
import com.mosty.rwzx.mapper.TbRwTaskMapper;
|
||||
import com.mosty.rwzx.mapper.TbRwTaskUserAllMapper;
|
||||
import com.mosty.rwzx.mapper.TbRwTaskUserMapper;
|
||||
import com.mosty.rwzx.remote.TbBaseAdaptRemoteService;
|
||||
import com.mosty.rwzx.remote.TbJcglAdaptRemoteService;
|
||||
import com.mosty.rwzx.remote.TbQwzxAdaptRemoteService;
|
||||
import com.mosty.rwzx.service.TbRwTaskInnerService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.awt.geom.FlatteningPathIterator;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TbRwTaskInnerServiceImpl extends ServiceImpl<TbRwTaskMapper, TbRwTask>
|
||||
implements TbRwTaskInnerService {
|
||||
|
||||
private final TbRwTaskLogMapper tbRwTaskLogMapper;
|
||||
private final TbRwTaskUserMapper tbRwTaskUserMapper;
|
||||
private final TbRwTaskUserAllMapper tbRwTaskUserAllMapper;
|
||||
private final TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
|
||||
private final TbQwzxAdaptRemoteService tbQwzxAdaptRemoteService;
|
||||
|
||||
@Override
|
||||
public int addRw(TbRwTaskInnerDto dto) {
|
||||
UserInfo user = UserInfoManager.get();
|
||||
if (user == null) {
|
||||
throw new BusinessException("请重新登录!!");
|
||||
}
|
||||
TbRwTask task = new TbRwTask();
|
||||
BeanUtils.copyProperties(dto, task);
|
||||
task.setId(UUIDGenerator.getUUID());
|
||||
task.setRwfqsj(new Date());
|
||||
task.setRwzt("0");
|
||||
task.setRwjxzt("1");
|
||||
task.setCjrid(String.valueOf(user.getUserId()));
|
||||
task.setCjrxm(user.getUserName());
|
||||
task.setCjrsfzh(user.getIdEntityCard());
|
||||
task.setSsbmid(String.valueOf(user.getDeptId()));
|
||||
task.setSsbm(String.valueOf(user.getDeptName()));
|
||||
task.setSsbmdm(user.getDeptCode());
|
||||
task.setSsxgajid(String.valueOf(user.getFxjDeptId()));
|
||||
task.setSsxgaj(user.getFxjDeptName());
|
||||
task.setSsxgajdm(user.getFxjDeptCode());
|
||||
task.setSssgajid(String.valueOf(user.getDszDeptId()));
|
||||
task.setSssgaj(user.getDszDeptName());
|
||||
task.setSssgajdm(user.getDszDeptCode());
|
||||
task.setXtSjly("1");
|
||||
// 添加发送人
|
||||
List<TbRwTaskUserInnerDto> userDtoList = dto.getUserDtoList();
|
||||
if (CollectionUtils.isEmpty(userDtoList)) {
|
||||
throw new BusinessException("请至少选择一个人员接收任务");
|
||||
}
|
||||
// TODO 计算接收人数量
|
||||
task.setRwzxrysl(userDtoList.size());
|
||||
userDtoList.forEach(item -> {
|
||||
TbRwTaskUser taskUser = new TbRwTaskUser();
|
||||
BeanUtils.copyProperties(task, taskUser);
|
||||
taskUser.setId(UUIDGenerator.getUUID());
|
||||
taskUser.setRwid(task.getId());
|
||||
taskUser.setGrrwzt("0");
|
||||
taskUser.setRwid(task.getId());
|
||||
taskUser.setRwjsdx(task.getRwjsdx());
|
||||
taskUser.setRwzflx("1");
|
||||
taskUser.setJsrid(item.getJsrid());
|
||||
taskUser.setJsrlxdh(item.getJsrlxdh());
|
||||
taskUser.setJsrmc(item.getJsrmc());
|
||||
taskUser.setJsrsfzh(item.getJsrsfzh());
|
||||
taskUser.setJsxzmc(item.getJsxzmc());
|
||||
taskUser.setJsxzid(item.getJsxzid());
|
||||
taskUser.setJsbmmc(item.getJsbmdm());
|
||||
taskUser.setJsbmmc(item.getJsbmmc());
|
||||
DeptInfoVo dept = null;
|
||||
if ("01".equals(item.getRwjsdx())) {
|
||||
dept = this.tbBaseAdaptRemoteService.getDeptInfoByUserId(item.getJsrid());
|
||||
} else if ("02".equals(item.getRwjsdx())) {
|
||||
dept = this.tbBaseAdaptRemoteService.getOrgByDeptId(item.getJsbmdm());
|
||||
taskUser.setJsbmmc(dept.getDeptname());
|
||||
} else if ("03".equals(item.getRwjsdx())) {
|
||||
TbQwXfbbVo bb = this.tbQwzxAdaptRemoteService.getBbInfo(item.getJsxzid());
|
||||
if (bb != null) {
|
||||
dept = this.tbBaseAdaptRemoteService.getOrgByDeptId(bb.getSsbmid());
|
||||
}
|
||||
}
|
||||
if (dept != null) {
|
||||
taskUser.setSsbmdm(dept.getDeptcode());
|
||||
taskUser.setSsbmid(dept.getDeptid());
|
||||
taskUser.setSsbm(dept.getDeptname());
|
||||
taskUser.setSsxgajid(dept.getFxjid());
|
||||
taskUser.setSsxgaj(dept.getFxjname());
|
||||
taskUser.setSsxgajdm(dept.getFxjcode());
|
||||
taskUser.setSssgaj(dept.getDszname());
|
||||
taskUser.setSssgajdm(dept.getDszcode());
|
||||
taskUser.setSssgajid(dept.getDszid());
|
||||
taskUser.setXtSjly("2");
|
||||
}
|
||||
this.tbRwTaskUserMapper.insert(taskUser);
|
||||
// 保存所有任务
|
||||
TbRwTaskUserAll userAll = new TbRwTaskUserAll();
|
||||
BeanUtils.copyProperties(taskUser, userAll);
|
||||
this.tbRwTaskUserAllMapper.insert(userAll);
|
||||
});
|
||||
// 保存任务日志
|
||||
TbRwTaskLog log = new TbRwTaskLog();
|
||||
log.setId(UUIDGenerator.getUUID());
|
||||
log.setRwid(task.getId());
|
||||
log.setRzlx("09");
|
||||
log.setRznr(DateUtils.getQueryDateString(new Date(), "02") + "," + task.getCjrxm() + "发送了该任务。");
|
||||
log.setBgrid(task.getCjrid());
|
||||
log.setBgsj(new Date());
|
||||
log.setBgrdhhm(task.getCjrlxdh());
|
||||
log.setBgrsfzh(task.getCjrsfzh());
|
||||
log.setBgrxm(task.getCjrxm());
|
||||
log.setSsbmid(String.valueOf(user.getDeptId()));
|
||||
log.setSsbm(String.valueOf(user.getDeptName()));
|
||||
log.setSsbmdm(user.getDeptCode());
|
||||
log.setSsxgajid(String.valueOf(user.getFxjDeptId()));
|
||||
log.setSsxgajdm(user.getFxjDeptCode());
|
||||
log.setSsxgaj(user.getFxjDeptName());
|
||||
log.setSssgajid(String.valueOf(user.getDszDeptId()));
|
||||
log.setSssgaj(user.getDszDeptName());
|
||||
log.setSssgajdm(user.getDszDeptCode());
|
||||
log.setXtSjly("1");
|
||||
this.tbRwTaskLogMapper.insertEntity(log);
|
||||
return this.baseMapper.insert(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TbRwTaskVo> selectPage(TbRwTaskInnerQuery dto) {
|
||||
if (!StringUtils.isEmpty(dto.getKssj())) {
|
||||
dto.setKssj(dto.getKssj() + " 00:00:00");
|
||||
}
|
||||
if (!StringUtils.isEmpty(dto.getJssj())) {
|
||||
dto.setJssj(dto.getJssj() + " 00:00:00");
|
||||
}
|
||||
IPage<TbRwTaskVo> rPage = new Page<>(dto.getPageCurrent(), dto.getPageSize());
|
||||
List<String> rwjsdx = !StringUtils.isEmpty(dto.getRwjsdx()) ? Arrays.asList(dto.getRwjsdx().split(",")) : null;
|
||||
List<String> rwxl = !StringUtils.isEmpty(dto.getRwxl()) ? Arrays.asList(dto.getRwxl().split(",")) : null;
|
||||
QueryWrapper<TbRwTask> qw = new QueryWrapper<>();
|
||||
// UserInfo user = UserInfoManager.get();
|
||||
// PermissionsUtil.queryWrapperUtil(qw, user);
|
||||
dto.setSsbmdm(this.tbBaseAdaptRemoteService.getSsbm(dto.getSsbmdm(), null));
|
||||
|
||||
IPage<TbRwTask> page = this.baseMapper.selectPage(
|
||||
new Page<>(dto.getPageCurrent(), dto.getPageSize()),
|
||||
qw.lambda()
|
||||
.eq(!StringUtils.isEmpty(dto.getYwid()), TbRwTask::getYwid, dto.getYwid())
|
||||
.like(!StringUtils.isEmpty(dto.getRwmc()), TbRwTask::getRwmc, dto.getRwmc())
|
||||
.like(!StringUtils.isEmpty(dto.getRwnr()), TbRwTask::getRwnr, dto.getRwnr())
|
||||
.in(rwjsdx != null, TbRwTask::getRwjsdx, rwjsdx)
|
||||
.in(rwxl != null, TbRwTask::getRwxl, rwxl)
|
||||
.eq(!StringUtils.isEmpty(dto.getRwlx()), TbRwTask::getRwlx, dto.getRwlx())
|
||||
.eq(!StringUtils.isEmpty(dto.getRwjjcd()), TbRwTask::getRwjjcd, dto.getRwjjcd())
|
||||
.eq(!StringUtils.isEmpty(dto.getRwms()), TbRwTask::getRwms, dto.getRwms())
|
||||
.eq(!StringUtils.isEmpty(dto.getRwjxzt()), TbRwTask::getRwjxzt, dto.getRwjxzt())
|
||||
.eq(!StringUtils.isEmpty(dto.getRwzt()), TbRwTask::getRwzt, dto.getRwzt())
|
||||
.eq(!StringUtils.isEmpty(dto.getCjrid()), TbRwTask::getCjrid, dto.getCjrid())
|
||||
.eq(!StringUtils.isEmpty(dto.getRwxxlx()), TbRwTask::getRwxxlx, dto.getRwxxlx())
|
||||
.like(!StringUtils.isEmpty(dto.getCjrxm()), TbRwTask::getCjrxm, dto.getCjrxm())
|
||||
.likeRight(!StringUtils.isEmpty(dto.getSsbmdm()), TbRwTask::getSsbmdm, dto.getSsbmdm())
|
||||
.ge(!StringUtils.isEmpty(dto.getKssj()), TbRwTask::getRwfqsj, dto.getKssj())
|
||||
.le(!StringUtils.isEmpty(dto.getJssj()), TbRwTask::getRwfqsj, dto.getJssj())
|
||||
.orderByDesc(TbRwTask::getRwfqsj)
|
||||
);
|
||||
List<TbRwTask> list = page.getRecords();
|
||||
List<TbRwTaskVo> rList = new ArrayList<>();
|
||||
list.forEach(item -> {
|
||||
TbRwTaskVo vo = new TbRwTaskVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
rList.add(vo);
|
||||
});
|
||||
rPage.setRecords(rList);
|
||||
rPage.setTotal(page.getTotal());
|
||||
return rPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TbRwTaskUser> selectMyPage(TbRwTaskMyInnerQuery dto) {
|
||||
if (!StringUtils.isEmpty(dto.getKssj())) {
|
||||
dto.setKssj(dto.getKssj() + " 00:00:00");
|
||||
}
|
||||
if (!StringUtils.isEmpty(dto.getJssj())) {
|
||||
dto.setJssj(dto.getJssj() + " 00:00:00");
|
||||
}
|
||||
UserInfo userInfo = UserInfoManager.get();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageIndex", (dto.getPageCurrent() - 1) * dto.getPageSize());
|
||||
map.put("pageSize", dto.getPageSize());
|
||||
map.put("sfzh", userInfo.getIdEntityCard());
|
||||
map.put("dto", dto);
|
||||
map.put("ssbmid", String.valueOf(userInfo.getDeptId()));
|
||||
List<TbRwTaskUser> list = this.baseMapper.getMyRwList(map);
|
||||
int count = this.baseMapper.getMyRwCount(map);
|
||||
IPage<TbRwTaskUser> page = new Page<>(dto.getPageCurrent(), dto.getPageSize());
|
||||
page.setRecords(list);
|
||||
page.setTotal(count);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单用户更改已查看
|
||||
* 单人模式修改单人状态,并判断是否完成,修改任务状态
|
||||
* 多人模式修改所有人状态,修改任务状态
|
||||
*
|
||||
* @param task
|
||||
* @param dto
|
||||
*/
|
||||
private void changeZf(TbRwTask task, TbRwTaskGrChangeStateInnerDto dto) {
|
||||
DeptInfoVo zfDept = this.tbBaseAdaptRemoteService.getDeptInfoByUserId(dto.getZfjsrid());
|
||||
SysUser zfUser = this.tbBaseAdaptRemoteService.getUserInfo(dto.getZfjsrid());
|
||||
TbRwTaskUser temp = this.tbRwTaskUserMapper.selectByRwId(zfUser.getIdEntityCard(), task.getId(), zfDept.getDeptid());
|
||||
// 判断被转发人是否有该任务,如果有,则提示
|
||||
if (temp != null) {
|
||||
throw new BusinessException("该人员已存在该任务,不能转发给本人!");
|
||||
}
|
||||
UserInfo user = UserInfoManager.get();
|
||||
TbRwTaskUser taskUser = this.tbRwTaskUserMapper.selectByRwId(user.getIdEntityCard(),
|
||||
task.getId(), String.valueOf(user.getDeptId()));
|
||||
TbRwTaskUserAll taskUserAll = this.tbRwTaskUserAllMapper.selectByRwId(user.getIdEntityCard(),
|
||||
task.getId(), String.valueOf(user.getDeptId()));
|
||||
taskUser.setGrrwzt("3");
|
||||
taskUserAll.setGrrwzt("3");
|
||||
taskUser.setYjsj(new Date());
|
||||
taskUserAll.setYjsj(new Date());
|
||||
// 记录日志
|
||||
TbRwTaskLog log = new TbRwTaskLog();
|
||||
SysUser jsr = this.tbBaseAdaptRemoteService.getUserInfo(dto.getZfjsrid());
|
||||
String rznr = DateUtils.getQueryDateString(new Date(), "2") + "," + user.getUserName() +
|
||||
"转发了该任务,转发给->" + jsr.getUserName();
|
||||
String rzlx = "4";
|
||||
log.setId(UUIDGenerator.getUUID()).setRwid(task.getId()).setRzlx(rzlx).setRznr(rznr).setJd(dto.getJd()).setWd(dto.getWd())
|
||||
.setBgsj(new Date())
|
||||
.setBgrid(String.valueOf(user.getUserId()))
|
||||
.setBgrxm(user.getUserName())
|
||||
.setBgrsfzh(user.getIdEntityCard())
|
||||
.setSsbm(user.getDeptName())
|
||||
.setSsbmdm(String.valueOf(user.getDeptName()))
|
||||
.setSsxgaj(user.getFxjDeptName())
|
||||
.setSsxgajdm(String.valueOf(user.getFxjDeptId()))
|
||||
.setSssgaj(user.getDszDeptName())
|
||||
.setSssgajdm(String.valueOf(user.getDszDeptId()))
|
||||
.setXtSjly("2");
|
||||
if (log.getJd() != null && log.getWd() != null) {
|
||||
log.setZb(JtsUtils.getPoint(log.getJd(), log.getWd())).setZbhash(GeoHashKit.encode(log.getJd(), log.getWd()));
|
||||
}
|
||||
this.tbRwTaskLogMapper.insertEntity(log);
|
||||
// 重新生成一条数据
|
||||
TbRwTaskUser newUser = new TbRwTaskUser();
|
||||
BeanUtils.copyProperties(taskUser, newUser);
|
||||
newUser.setRwzflx("2")
|
||||
.setId(UUIDGenerator.getUUID())
|
||||
.setGrrwzt("0")
|
||||
.setJsrid(String.valueOf(jsr.getId()))
|
||||
.setJsrlxdh(jsr.getMobile())
|
||||
.setJsrsfzh(jsr.getIdEntityCard())
|
||||
.setJsrmc(jsr.getUserName())
|
||||
.setJsxzid(null)
|
||||
.setJsxzmc(null)
|
||||
.setJsbmmc(null)
|
||||
.setJsbmdm(null)
|
||||
.setXtSjly("2");
|
||||
DeptInfoVo dept = this.tbBaseAdaptRemoteService.getDeptInfoByUserId(dto.getZfjsrid());
|
||||
newUser.setSsbmid(dept.getDeptid());
|
||||
newUser.setSsbmdm(dept.getDeptcode());
|
||||
newUser.setSsbm(dept.getDeptname());
|
||||
newUser.setSsxgaj(dept.getFxjname());
|
||||
newUser.setSsxgajid(dept.getFxjid());
|
||||
newUser.setSsxgajdm(dept.getFxjcode());
|
||||
newUser.setSssgaj(dept.getDszname());
|
||||
newUser.setSssgajid(dept.getDszid());
|
||||
newUser.setSssgajdm(dept.getDszcode());
|
||||
newUser.setBhtaskuserid(taskUser.getId());
|
||||
this.tbRwTaskUserMapper.insert(newUser);
|
||||
TbRwTaskUserAll newUserAll = new TbRwTaskUserAll();
|
||||
BeanUtils.copyProperties(newUser, newUserAll);
|
||||
this.tbRwTaskUserAllMapper.insert(newUserAll);
|
||||
this.tbRwTaskUserMapper.updateById(taskUser);
|
||||
this.tbRwTaskUserAllMapper.updateById(taskUserAll);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeStateByYwid(TbRwTaskChangeStateByYwidDto dtos) {
|
||||
TbRwTask task = this.baseMapper.selectOne(
|
||||
new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getYwid, dtos.getYwid())
|
||||
.eq(TbRwTask::getXtSjzt, "1")
|
||||
.eq(!StringUtils.isEmpty(dtos.getRwxxlx()), TbRwTask::getRwxxlx, dtos.getRwxxlx())
|
||||
);
|
||||
if (task != null) {
|
||||
TbRwTaskGrChangeStateInnerDto dto = new TbRwTaskGrChangeStateInnerDto();
|
||||
dto.setJd(dtos.getJd());
|
||||
dto.setWd(dtos.getWd());
|
||||
dto.setRwid(task.getId());
|
||||
dto.setRwzt(dtos.getRwzt());
|
||||
if ("1".equals(dto.getRwzt()) || "2".equals(dto.getRwzt())) {
|
||||
// 进行中
|
||||
this.changeJxzOrYwc(task, dto, dto.getRwzt());
|
||||
} else if ("3".equals(dto.getRwzt())) {
|
||||
// 已转发
|
||||
this.changeZf(task, dto);
|
||||
} else if ("4".equals(dto.getRwzt())) {
|
||||
// 被驳回
|
||||
this.changeBh(task, dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> myRwCount() {
|
||||
UserInfo user = UserInfoManager.get();
|
||||
if (user == null) {
|
||||
throw new BusinessException("登录过期,请重新登录");
|
||||
}
|
||||
return this.baseMapper.myRwCount(user.getIdEntityCard(), String.valueOf(user.getDeptId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> rwCountByState(TbRwTaskInnerQuery dto) {
|
||||
if (!StringUtils.isEmpty(dto.getKssj())) {
|
||||
dto.setKssj(dto.getKssj() + " 00:00:00");
|
||||
}
|
||||
if (!StringUtils.isEmpty(dto.getJssj())) {
|
||||
dto.setJssj(dto.getJssj() + " 00:00:00");
|
||||
}
|
||||
List<String> rwjsdx = !StringUtils.isEmpty(dto.getRwjsdx()) ? Arrays.asList(dto.getRwjsdx().split(",")) : null;
|
||||
List<String> rwxl = !StringUtils.isEmpty(dto.getRwxl()) ? Arrays.asList(dto.getRwxl().split(",")) : null;
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("rwjsdxList", rwjsdx);
|
||||
map.put("rwxlList", rwxl);
|
||||
map.put("dto", dto);
|
||||
return this.baseMapper.rwCountByState(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 被驳回
|
||||
*
|
||||
* @param task
|
||||
* @param dto
|
||||
*/
|
||||
private void changeBh(TbRwTask task, TbRwTaskGrChangeStateInnerDto dto) {
|
||||
UserInfo user = UserInfoManager.get();
|
||||
|
||||
TbRwTaskUser taskUser = this.tbRwTaskUserMapper.selectOne(
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(TbRwTaskUser::getJsrsfzh, user.getIdEntityCard())
|
||||
.eq(TbRwTaskUser::getRwid, task.getId())
|
||||
);
|
||||
TbRwTaskUserAll taskUserAll = this.tbRwTaskUserAllMapper.selectOne(
|
||||
new LambdaQueryWrapper<TbRwTaskUserAll>()
|
||||
.eq(TbRwTaskUserAll::getJsrsfzh, user.getIdEntityCard())
|
||||
.eq(TbRwTaskUserAll::getRwid, task.getId())
|
||||
);
|
||||
taskUser.setGrrwzt("4");
|
||||
taskUserAll.setGrrwzt("4");
|
||||
// 记录日志
|
||||
TbRwTaskLog log = new TbRwTaskLog();
|
||||
String rznr = DateUtils.getQueryDateString(new Date(), "2") + "," + user.getUserName()
|
||||
+ "驳回了该任务。";
|
||||
String rzlx = "8";
|
||||
log.setId(UUIDGenerator.getUUID())
|
||||
.setRwid(task.getId())
|
||||
.setRzlx(rzlx)
|
||||
.setRznr(rznr)
|
||||
.setJd(dto.getJd())
|
||||
.setWd(dto.getWd())
|
||||
.setBgsj(new Date())
|
||||
.setBgrid(String.valueOf(user.getUserId()))
|
||||
.setBgrxm(user.getUserName())
|
||||
.setBgrsfzh(user.getIdEntityCard())
|
||||
.setSsbm(user.getDeptName())
|
||||
.setSsbmdm(String.valueOf(user.getDeptName()))
|
||||
.setSsxgaj(user.getFxjDeptName())
|
||||
.setSsxgajdm(String.valueOf(user.getFxjDeptId()))
|
||||
.setSssgaj(user.getDszDeptName())
|
||||
.setSssgajdm(String.valueOf(user.getDszDeptId()))
|
||||
.setXtSjly("2");
|
||||
if (log.getJd() != null && log.getWd() != null) {
|
||||
log.setZb(JtsUtils.getPoint(log.getJd(), log.getWd())).setZbhash(GeoHashKit.encode(log.getJd(), log.getWd()));
|
||||
}
|
||||
this.tbRwTaskLogMapper.insertEntity(log);
|
||||
// 发送新任务
|
||||
TbRwTaskUser bhtaskUser = this.tbRwTaskUserMapper.selectById(taskUser.getBhtaskuserid());
|
||||
TbRwTaskUserAll bhtaskUserAll = this.tbRwTaskUserAllMapper.selectById(taskUser.getBhtaskuserid());
|
||||
bhtaskUser.setRwzflx("3");
|
||||
bhtaskUserAll.setRwzflx("3");
|
||||
bhtaskUser.setGrrwzt("0");
|
||||
bhtaskUserAll.setGrrwzt("0");
|
||||
this.tbRwTaskUserMapper.updateById(bhtaskUser);
|
||||
this.tbRwTaskUserAllMapper.updateById(bhtaskUserAll);
|
||||
this.tbRwTaskUserMapper.updateById(taskUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeGrrwState(TbRwTaskGrChangeStateInnerDto dto) {
|
||||
TbRwTask task = this.baseMapper.selectById(dto.getRwid());
|
||||
if (task != null) {
|
||||
if ("1".equals(dto.getRwzt()) || "2".equals(dto.getRwzt())) {
|
||||
// 进行中
|
||||
this.changeJxzOrYwc(task, dto, dto.getRwzt());
|
||||
} else if ("3".equals(dto.getRwzt())) {
|
||||
// 已转发
|
||||
this.changeZf(task, dto);
|
||||
} else if ("4".equals(dto.getRwzt())) {
|
||||
// 被驳回
|
||||
this.changeBh(task, dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeRwState(TbRwTaskChangeStateInnerDto dto) {
|
||||
UserInfo user = UserInfoManager.get();
|
||||
TbRwTask task = this.baseMapper.selectById(dto.getId());
|
||||
if (task != null) {
|
||||
task.setRwzt(dto.getRwzt());
|
||||
this.baseMapper.updateById(task);
|
||||
// 记录日志
|
||||
String rznr = "";
|
||||
String rzlx = "";
|
||||
if ("0".equals(dto.getRwzt())) {
|
||||
rznr = "重启了该任务。";
|
||||
rzlx = "6";
|
||||
} else if ("1".equals(dto.getRwzt())) {
|
||||
rznr = "关闭了该任务。";
|
||||
rzlx = "1";
|
||||
} else if ("2".equals(dto.getRwzt())) {
|
||||
rznr = "暂停了该任务。";
|
||||
rzlx = "5";
|
||||
}
|
||||
TbRwTaskLog log = new TbRwTaskLog();
|
||||
rznr = DateUtils.getQueryDateString(new Date(), "2") + "," + user.getUserName() + rznr;
|
||||
log.setId(UUIDGenerator.getUUID()).setRwid(task.getId()).setRzlx(rzlx).setRznr(rznr)
|
||||
.setJd(dto.getJd()).setWd(dto.getWd()).setBgsj(new Date())
|
||||
.setBgrid(String.valueOf(user.getUserId()))
|
||||
.setBgrxm(user.getUserName())
|
||||
.setBgrsfzh(user.getIdEntityCard())
|
||||
.setSsbm(user.getDeptName())
|
||||
.setSsbmdm(String.valueOf(user.getDeptName()))
|
||||
.setSsxgaj(user.getFxjDeptName())
|
||||
.setSsxgajdm(String.valueOf(user.getFxjDeptId()))
|
||||
.setSssgaj(user.getDszDeptName())
|
||||
.setSssgajdm(String.valueOf(user.getDszDeptId()))
|
||||
.setXtSjly("2");
|
||||
if (log.getJd() != null && log.getWd() != null) {
|
||||
log.setZb(JtsUtils.getPoint(log.getJd(), log.getWd())).setZbhash(GeoHashKit.encode(log.getJd(), log.getWd()));
|
||||
}
|
||||
this.tbRwTaskLogMapper.insertEntity(log);
|
||||
// 修改用户表的任务状态
|
||||
List<TbRwTaskUser> userList = this.tbRwTaskUserMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(TbRwTaskUser::getRwid, task.getId())
|
||||
);
|
||||
userList.forEach(item -> {
|
||||
item.setRwzt(dto.getRwzt());
|
||||
this.tbRwTaskUserMapper.updateById(item);
|
||||
});
|
||||
// 修改所有用户表的状态
|
||||
List<TbRwTaskUserAll> userAllList = this.tbRwTaskUserAllMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUserAll>()
|
||||
.eq(TbRwTaskUserAll::getRwid, task.getId())
|
||||
);
|
||||
userAllList.forEach(item -> {
|
||||
item.setRwzt(dto.getRwzt());
|
||||
this.tbRwTaskUserAllMapper.updateById(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单用户更改已查看
|
||||
* 单人模式修改单人状态,并判断是否完成,修改任务状态
|
||||
* 多人模式修改所有人状态,修改任务状态
|
||||
*
|
||||
* @param task 任务
|
||||
* @param dto dto
|
||||
*/
|
||||
private void changeJxzOrYwc(TbRwTask task, TbRwTaskGrChangeStateInnerDto dto, String grrwzt) {
|
||||
UserInfo user = UserInfoManager.get();
|
||||
|
||||
TbRwTaskUser taskUser = this.tbRwTaskUserMapper.selectByRwId(user.getIdEntityCard(), task.getId(),
|
||||
String.valueOf(user.getDeptId()));
|
||||
TbRwTaskUserAll taskUserAll = this.tbRwTaskUserAllMapper.selectByRwId(user.getIdEntityCard(), task.getId(),
|
||||
String.valueOf(user.getDeptId()));
|
||||
if (taskUser != null) {
|
||||
taskUser.setGrrwzt(grrwzt);
|
||||
taskUserAll.setGrrwzt(grrwzt);
|
||||
// 记录日志
|
||||
TbRwTaskLog log = new TbRwTaskLog();
|
||||
String rznr;
|
||||
String rzlx;
|
||||
if ("1".equals(grrwzt)) {
|
||||
rznr = DateUtils.getQueryDateString(new Date(), "2") + "," + user.getUserName() +
|
||||
"查看了该任务,任务开始!";
|
||||
rzlx = "2";
|
||||
} else {
|
||||
rznr = DateUtils.getQueryDateString(new Date(), "2") + "," + user.getUserName() + "完成了该任务";
|
||||
rzlx = "3";
|
||||
}
|
||||
log.setId(UUIDGenerator.getUUID())
|
||||
.setRwid(task.getId())
|
||||
.setRzlx(rzlx)
|
||||
.setRznr(rznr)
|
||||
.setJd(dto.getJd())
|
||||
.setWd(dto.getWd())
|
||||
.setBgsj(new Date())
|
||||
.setBgrid(String.valueOf(user.getUserId()))
|
||||
.setBgrxm(user.getUserName())
|
||||
.setBgrsfzh(user.getIdEntityCard())
|
||||
.setSsbm(user.getDeptName())
|
||||
.setSsbmid(String.valueOf(user.getDeptId()))
|
||||
.setSsbmdm(user.getDeptCode())
|
||||
.setSsxgaj(user.getFxjDeptName())
|
||||
.setSsxgajid(String.valueOf(user.getFxjDeptId()))
|
||||
.setSsxgajdm(user.getFxjDeptCode())
|
||||
.setSssgaj(user.getDszDeptName())
|
||||
.setSssgajid(String.valueOf(user.getDszDeptId()))
|
||||
.setSssgajdm(user.getDszDeptCode())
|
||||
.setXtSjly("2");
|
||||
if (log.getJd() != null && log.getWd() != null) {
|
||||
log.setZb(JtsUtils.getPoint(log.getJd(), log.getWd()))
|
||||
.setZbhash(GeoHashKit.encode(log.getJd(), log.getWd()));
|
||||
}
|
||||
this.tbRwTaskLogMapper.insertEntity(log);
|
||||
if ("2".equals(task.getRwms())) {
|
||||
// 判断当所有用户已读的时候,将消息改为已读
|
||||
List<TbRwTaskUser> userList = this.tbRwTaskUserMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(TbRwTaskUser::getRwid, task.getId()
|
||||
)
|
||||
);
|
||||
long count = userList.stream().filter(item -> "0".equals(item.getRwzt()) || "1".equals(item.getRwzt())).count();
|
||||
if (count == 0) {
|
||||
task.setRwjxzt("1".equals(task.getRwjxzt()) || "3".equals(task.getRwjxzt()) ? "3" : "4");
|
||||
taskUser.setRwjxzt("1".equals(task.getRwjxzt()) || "3".equals(task.getRwjxzt()) ? "3" : "4");
|
||||
taskUserAll.setRwjxzt("1".equals(task.getRwjxzt()) || "3".equals(task.getRwjxzt()) ? "3" : "4");
|
||||
task.setRwwcsj(new Date());
|
||||
taskUser.setRwwcsj(new Date());
|
||||
taskUserAll.setRwwcsj(new Date());
|
||||
}
|
||||
this.baseMapper.updateById(task);
|
||||
} else {
|
||||
// 根据一个用户的状态完成任务状态
|
||||
List<TbRwTaskUser> userList = this.tbRwTaskUserMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(TbRwTaskUser::getRwid, task.getId())
|
||||
);
|
||||
userList.forEach(item -> {
|
||||
item.setGrrwzt(grrwzt);
|
||||
if ("1".equals(grrwzt)) {
|
||||
this.tbRwTaskUserMapper.updateById(item);
|
||||
} else {
|
||||
this.tbRwTaskUserMapper.deleteEntity(item.getId());
|
||||
}
|
||||
});
|
||||
if ("2".equals(grrwzt)) {
|
||||
task.setRwjxzt("1".equals(task.getRwjxzt()) || "3".equals(task.getRwjxzt()) ? "3" : "4");
|
||||
taskUser.setRwjxzt("1".equals(task.getRwjxzt()) || "3".equals(task.getRwjxzt()) ? "3" : "4");
|
||||
taskUserAll.setRwjxzt("1".equals(task.getRwjxzt()) || "3".equals(task.getRwjxzt()) ? "3" : "4");
|
||||
task.setRwwcsj(new Date());
|
||||
taskUser.setRwwcsj(new Date());
|
||||
taskUserAll.setRwwcsj(new Date());
|
||||
this.baseMapper.updateById(task);
|
||||
}
|
||||
}
|
||||
this.tbRwTaskUserAllMapper.updateById(taskUserAll);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,571 @@
|
||||
package com.mosty.rwzx.service.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mosty.base.model.dto.qwzx.TbQwJlDto;
|
||||
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
|
||||
import com.mosty.base.model.dto.rwzx.*;
|
||||
import com.mosty.base.model.entity.qwzx.TbQwJl;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTask;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskLog;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUser;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUserAll;
|
||||
import com.mosty.base.model.entity.yjzl.TbZlxx;
|
||||
import com.mosty.base.model.query.rwzx.*;
|
||||
import com.mosty.base.model.vo.base.DeptInfoVo;
|
||||
import com.mosty.base.model.vo.jcgl.TbJcglDsfVo;
|
||||
import com.mosty.base.model.vo.rwzx.*;
|
||||
import com.mosty.base.utils.*;
|
||||
import com.mosty.common.base.exception.BusinessException;
|
||||
import com.mosty.common.config.entity.SysDictItem;
|
||||
import com.mosty.common.core.business.entity.SysUser;
|
||||
import com.mosty.common.core.business.entity.vo.SysUserDeptVO;
|
||||
import com.mosty.common.core.business.entity.vo.SysUserVO;
|
||||
import com.mosty.common.token.UserInfo;
|
||||
import com.mosty.common.token.UserInfoManager;
|
||||
import com.mosty.rwzx.mapper.TbRwTaskUserAllMapper;
|
||||
import com.mosty.rwzx.remote.TbBaseAdaptRemoteService;
|
||||
import com.mosty.rwzx.mapper.TbRwTaskLogMapper;
|
||||
import com.mosty.rwzx.mapper.TbRwTaskMapper;
|
||||
import com.mosty.rwzx.mapper.TbRwTaskUserMapper;
|
||||
import com.mosty.rwzx.remote.TbJcglAdaptRemoteService;
|
||||
import com.mosty.rwzx.remote.TbQwzxAdaptRemoteService;
|
||||
import com.mosty.rwzx.service.TbRwTaskService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TbRwTaskServiceImpl extends ServiceImpl<TbRwTaskMapper, TbRwTask> implements TbRwTaskService {
|
||||
|
||||
private final TbRwTaskMapper tbRwTaskMapper;
|
||||
private final TbRwTaskLogMapper tbRwTaskLogMapper;
|
||||
private final TbRwTaskUserMapper tbRwTaskUserMapper;
|
||||
private final TbBaseAdaptRemoteService tbBaseAdaptRemoteService;
|
||||
private final TbJcglAdaptRemoteService tbJcglAdaptRemoteService;
|
||||
private final TbQwzxAdaptRemoteService tbQwzxAdaptRemoteService;
|
||||
private final TbRwTaskUserAllMapper tbRwTaskUserAllMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int addRw(TbRwTaskDto dto) {
|
||||
TbRwTask task = new TbRwTask();
|
||||
BeanUtils.copyProperties(dto, task);
|
||||
task.setId(UUIDGenerator.getUUID());
|
||||
task.setRwfqsj(new Date());
|
||||
task.setRwzt("0");
|
||||
task.setRwjxzt("1");
|
||||
task.setCjrid(dto.getCjrid());
|
||||
task.setCjrxm(dto.getCjrxm());
|
||||
task.setCjrsfzh(dto.getCjrsfzh());
|
||||
task.setCjrlxdh("");
|
||||
DeptInfoVo dept;
|
||||
dept = this.tbBaseAdaptRemoteService.getOrgByDeptId(dto.getSsbmid());
|
||||
if (dept != null) {
|
||||
task.setSsbmid(dept.getDeptid());
|
||||
task.setSsbm(dept.getDeptname());
|
||||
task.setSsbmdm(dept.getDeptcode());
|
||||
task.setSsxgajid(dept.getFxjid());
|
||||
task.setSsxgaj(dept.getFxjname());
|
||||
task.setSsxgajdm(dept.getFxjcode());
|
||||
task.setSssgajid(dept.getDszid());
|
||||
task.setSssgaj(dept.getDszname());
|
||||
task.setSssgajdm(dept.getDszcode());
|
||||
}
|
||||
task.setXtSjly("1");
|
||||
// 保存任务接收人信息
|
||||
List<TbRwTaskUserDto> userDtoList = dto.getUserDtoList();
|
||||
if (CollectionUtils.isEmpty(userDtoList)) {
|
||||
throw new BusinessException("请至少选择一个人员接收任务!!");
|
||||
}
|
||||
// TODO 计算任务接收人数量
|
||||
userDtoList.forEach(item -> {
|
||||
TbRwTaskUser taskUser = new TbRwTaskUser();
|
||||
BeanUtils.copyProperties(task, taskUser);
|
||||
taskUser.setId(UUIDGenerator.getUUID());
|
||||
taskUser.setRwid(task.getId());
|
||||
taskUser.setGrrwzt("0");
|
||||
taskUser.setRwid(task.getId());
|
||||
taskUser.setRwjsdx(task.getRwjsdx());
|
||||
taskUser.setRwzflx("1");
|
||||
taskUser.setJsrid(item.getJsrid());
|
||||
taskUser.setJsrlxdh(item.getJsrlxdh());
|
||||
taskUser.setJsrmc(item.getJsrmc());
|
||||
taskUser.setJsrsfzh(item.getJsrsfzh());
|
||||
taskUser.setJsxzmc(item.getJsxzmc());
|
||||
taskUser.setJsxzid(item.getJsxzid());
|
||||
taskUser.setJsbmdm(item.getJsbmdm());
|
||||
taskUser.setJsbmmc(item.getJsbmmc());
|
||||
DeptInfoVo userDept = null;
|
||||
if ("01".equals(dto.getRwjsdx())) {
|
||||
userDept = this.tbBaseAdaptRemoteService.getDeptInfoByUserId(item.getJsrid());
|
||||
} else if ("02".equals(dto.getRwjsdx())) {
|
||||
userDept = this.tbBaseAdaptRemoteService.getOrgByDeptId(item.getJsbmdm());
|
||||
taskUser.setJsbmmc(userDept.getDeptname());
|
||||
} else if ("03".equals(dto.getRwjsdx())) {
|
||||
TbQwXfbbVo bb = this.tbQwzxAdaptRemoteService.getBbInfo(item.getJsxzid());
|
||||
if (bb != null) {
|
||||
taskUser.setJsxzmc(bb.getJzMc());
|
||||
userDept = this.tbBaseAdaptRemoteService.getOrgByDeptId(bb.getSsbmid());
|
||||
}
|
||||
}
|
||||
if (userDept != null) {
|
||||
taskUser.setSsbmid(userDept.getDeptid());
|
||||
taskUser.setSsbm(userDept.getDeptname());
|
||||
taskUser.setSsbmdm(userDept.getDeptcode());
|
||||
taskUser.setSsxgajid(userDept.getFxjid());
|
||||
taskUser.setSsxgaj(userDept.getFxjname());
|
||||
taskUser.setSsxgajdm(userDept.getFxjcode());
|
||||
taskUser.setSssgajid(userDept.getDszid());
|
||||
taskUser.setSssgaj(userDept.getDszname());
|
||||
taskUser.setSssgajdm(userDept.getDszcode());
|
||||
taskUser.setXtSjly("1");
|
||||
}
|
||||
this.tbRwTaskUserMapper.insert(taskUser);
|
||||
// 保存所有任务
|
||||
TbRwTaskUserAll userAll = new TbRwTaskUserAll();
|
||||
BeanUtils.copyProperties(taskUser, userAll);
|
||||
this.tbRwTaskUserAllMapper.insert(userAll);
|
||||
});
|
||||
// 保存任务日志
|
||||
TbRwTaskLog log = new TbRwTaskLog();
|
||||
log.setId(UUIDGenerator.getUUID());
|
||||
log.setRwid(task.getId());
|
||||
log.setRzlx("09");
|
||||
log.setRznr(DateUtils.getQueryDateString(new Date(), "02") + "," + task.getCjrxm() + "发送了该任务。");
|
||||
log.setBgrid(task.getCjrid());
|
||||
log.setBgsj(new Date());
|
||||
log.setBgrdhhm(task.getCjrlxdh());
|
||||
log.setBgrsfzh(task.getCjrsfzh());
|
||||
log.setBgrxm(task.getCjrxm());
|
||||
if (dept != null) {
|
||||
log.setSsbmid(dept.getDeptid());
|
||||
log.setSsbm(dept.getDeptname());
|
||||
log.setSsbmdm(dept.getDeptcode());
|
||||
log.setSsxgajid(dept.getFxjid());
|
||||
log.setSsxgaj(dept.getFxjname());
|
||||
log.setSsxgajdm(dept.getFxjcode());
|
||||
log.setSssgajid(dept.getDszid());
|
||||
log.setSssgaj(dept.getDszname());
|
||||
log.setSssgajdm(dept.getDszcode());
|
||||
}
|
||||
log.setXtSjly("1");
|
||||
this.tbRwTaskLogMapper.insertEntity(log);
|
||||
return this.baseMapper.insert(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbRwTaskVo getTaskInfo(String id) {
|
||||
UserInfo userInfo = UserInfoManager.get();
|
||||
List<TbRwTaskUser> userList = this.tbRwTaskUserMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(TbRwTaskUser::getRwid, id)
|
||||
.eq(TbRwTaskUser::getXtSjzt, "1")
|
||||
);
|
||||
if (userList != null && userList.size() > 0) {
|
||||
List<TbRwTaskUserVo> voList = new ArrayList<>();
|
||||
userList.forEach(item -> {
|
||||
TbRwTaskUserVo userVo = new TbRwTaskUserVo();
|
||||
BeanUtils.copyProperties(item, userVo);
|
||||
voList.add(userVo);
|
||||
});
|
||||
TbRwTaskVo vo = new TbRwTaskVo();
|
||||
BeanUtils.copyProperties(userList.get(0), vo);
|
||||
vo.setUserDtoList(voList);
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TbRwTaskUserVo> getTaskUserList(TbRwTaskUserQuery dto) {
|
||||
IPage<TbRwTaskUser> userPage = this.tbRwTaskUserMapper.selectPage(
|
||||
new Page<>(dto.getPageCurrent(), dto.getPageSize()),
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(!StringUtils.isEmpty(dto.getRwid()), TbRwTaskUser::getRwid, dto.getRwid())
|
||||
.eq(!StringUtils.isEmpty(dto.getRwzt()), TbRwTaskUser::getRwzt, dto.getRwzt())
|
||||
.like(!StringUtils.isEmpty(dto.getJsrmc()), TbRwTaskUser::getJsrmc, dto.getJsrmc())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmdm()), TbRwTaskUser::getSsbmdm, dto.getSsbmdm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmid()), TbRwTaskUser::getSsbmid, dto.getSsbmid()));
|
||||
List<TbRwTaskUserVo> voList = new ArrayList<>();
|
||||
userPage.getRecords().forEach(item -> {
|
||||
TbRwTaskUserVo vo = new TbRwTaskUserVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
voList.add(vo);
|
||||
});
|
||||
IPage<TbRwTaskUserVo> page = new Page<>(dto.getPageCurrent(), dto.getPageSize());
|
||||
page.setRecords(voList);
|
||||
page.setTotal(userPage.getTotal());
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TbRwTaskLogVo> getTaskLogList(TbRwTaskLogQuery dto) {
|
||||
IPage<TbRwTaskLog> userPage = this.tbRwTaskLogMapper.selectPage(
|
||||
new Page<>(dto.getPageCurrent(), dto.getPageSize()),
|
||||
new LambdaQueryWrapper<TbRwTaskLog>()
|
||||
.eq(!StringUtils.isEmpty(dto.getRwid()), TbRwTaskLog::getRwid, dto.getRwid())
|
||||
.eq(!StringUtils.isEmpty(dto.getRzlx()), TbRwTaskLog::getRzlx, dto.getRzlx())
|
||||
.like(!StringUtils.isEmpty(dto.getRznr()), TbRwTaskLog::getRznr, dto.getRznr())
|
||||
.like(!StringUtils.isEmpty(dto.getBgrxm()), TbRwTaskLog::getBgrxm, dto.getBgrxm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmdm()), TbRwTaskLog::getSsbmdm, dto.getSsbmdm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmid()), TbRwTaskLog::getSsbmid, dto.getSsbmid()));
|
||||
List<TbRwTaskLogVo> voList = new ArrayList<>();
|
||||
userPage.getRecords().forEach(item -> {
|
||||
TbRwTaskLogVo vo = new TbRwTaskLogVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
voList.add(vo);
|
||||
});
|
||||
IPage<TbRwTaskLogVo> page = new Page<>(dto.getPageCurrent(), dto.getPageSize());
|
||||
page.setRecords(voList);
|
||||
page.setTotal(userPage.getTotal());
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbRwTaskStatisticsVo getDataStatistics(TbRwTaskStatisticsDto dto) {
|
||||
Date d = null;
|
||||
if (!StringUtils.isEmpty(dto.getDateType())) {
|
||||
if ("1".equals(dto.getDateType())) {
|
||||
d = new Date();
|
||||
} else if ("2".equals(dto.getDateType())) {
|
||||
d = DateUtils.getNextDate(new Date(), "D", -7);
|
||||
} else {
|
||||
d = DateUtils.getNextDate(new Date(), "M", -1);
|
||||
}
|
||||
}
|
||||
TbRwTaskStatisticsVo vo = new TbRwTaskStatisticsVo();
|
||||
//总任务数
|
||||
Integer all = this.baseMapper.getCount("", d, dto.getSfzh());
|
||||
//进行中
|
||||
Integer jxz = this.baseMapper.getCount("1", d, dto.getSfzh());
|
||||
//超期进行中
|
||||
Integer cqjxz = this.baseMapper.getCount("2", d, dto.getSfzh());
|
||||
//已完成
|
||||
Integer ywc = this.baseMapper.getCount("3", d, dto.getSfzh());
|
||||
//超期完成
|
||||
Integer cqwc = this.baseMapper.getCount("4", d, dto.getSfzh());
|
||||
//超期未完成
|
||||
Integer cqwwc = this.baseMapper.getCount("5", d, dto.getSfzh());
|
||||
vo.setAll(all);
|
||||
vo.setJxz(jxz);
|
||||
vo.setCqjxz(cqjxz);
|
||||
vo.setCqwc(cqwc);
|
||||
vo.setYwc(ywc);
|
||||
vo.setCqwwc(cqwwc);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbRwTaskLXStatisticsVo> getRWLXDataStatistics(TbRwTaskStatisticsDto dto) {
|
||||
String d;
|
||||
if ("1".equals(dto.getDateType())) {
|
||||
d = DateUtils.getQueryDateString(new Date(), "01");
|
||||
} else if ("2".equals(dto.getDateType())) {
|
||||
d = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "D", -7), "01");
|
||||
} else {
|
||||
d = DateUtils.getQueryDateString(DateUtils.getNextDate(new Date(), "M", -1), "01");
|
||||
}
|
||||
List<SysDictItem> rwxl = tbRwTaskMapper.selectDict("D_BZ_RWXL");
|
||||
List<TbRwTaskLXStatisticsVo> ret = new ArrayList<>();
|
||||
if (null != rwxl) {
|
||||
for (SysDictItem sysDictItem : rwxl) {
|
||||
//分类查询
|
||||
TbRwTaskLXStatisticsVo vo = new TbRwTaskLXStatisticsVo();
|
||||
//后面 通过字典查询
|
||||
vo.setCt(sysDictItem.getZdmc());
|
||||
vo.setDm(sysDictItem.getDm());
|
||||
//总任务数
|
||||
Integer all = this.baseMapper.selectCount(new LambdaQueryWrapper<TbRwTask>()
|
||||
.last(" and DATE_FORMAT(rwfqsj,'%Y-%m-%d')" +
|
||||
" between DATE_FORMAT('" + d + "','%Y-%m-%d')" +
|
||||
" and DATE_FORMAT(now(),'%Y-%m-%d')")
|
||||
);
|
||||
//进行中
|
||||
Integer jxz = this.baseMapper.selectCount(new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getRwjxzt, "1")
|
||||
.eq(TbRwTask::getRwxl, sysDictItem.getDm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmdm()), TbRwTask::getSsbmdm, dto.getSsbmdm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmid()), TbRwTask::getSsbmid, dto.getSsbmid())
|
||||
.last(" and DATE_FORMAT(rwfqsj,'%Y-%m-%d')" +
|
||||
" between DATE_FORMAT('" + d + "','%Y-%m-%d')" +
|
||||
" and DATE_FORMAT(now(),'%Y-%m-%d')")
|
||||
);
|
||||
//超期进行中
|
||||
Integer cqjxz = this.baseMapper.selectCount(new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getRwjxzt, "2")
|
||||
.eq(TbRwTask::getRwxl, sysDictItem.getDm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmdm()), TbRwTask::getSsbmdm, dto.getSsbmdm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmid()), TbRwTask::getSsbmid, dto.getSsbmid())
|
||||
.last(" and DATE_FORMAT(rwfqsj,'%Y-%m-%d')" +
|
||||
" between DATE_FORMAT('" + d + "','%Y-%m-%d')" +
|
||||
" and DATE_FORMAT(now(),'%Y-%m-%d')")
|
||||
);
|
||||
//已完成
|
||||
Integer ywc = this.baseMapper.selectCount(new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getRwjxzt, "3")
|
||||
.eq(TbRwTask::getRwxl, sysDictItem.getDm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmdm()), TbRwTask::getSsbmdm, dto.getSsbmdm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmid()), TbRwTask::getSsbmid, dto.getSsbmid())
|
||||
.last(" and DATE_FORMAT(rwfqsj,'%Y-%m-%d')" +
|
||||
" between DATE_FORMAT('" + d + "','%Y-%m-%d')" +
|
||||
" and DATE_FORMAT(now(),'%Y-%m-%d')")
|
||||
);
|
||||
// 超期完成
|
||||
Integer cqwc = this.baseMapper.selectCount(new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getRwjxzt, "4")
|
||||
.eq(TbRwTask::getRwxl, sysDictItem.getDm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmdm()), TbRwTask::getSsbmdm, dto.getSsbmdm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmid()), TbRwTask::getSsbmid, dto.getSsbmid())
|
||||
.last(" and DATE_FORMAT(rwfqsj,'%Y-%m-%d')" +
|
||||
" between DATE_FORMAT('" + d + "','%Y-%m-%d')" +
|
||||
" and DATE_FORMAT(now(),'%Y-%m-%d')")
|
||||
);
|
||||
// 超期未完成
|
||||
Integer cqwwc = this.baseMapper.selectCount(new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getRwjxzt, "5")
|
||||
.eq(TbRwTask::getRwxl, sysDictItem.getDm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmdm()), TbRwTask::getSsbmdm, dto.getSsbmdm())
|
||||
.eq(!StringUtils.isEmpty(dto.getSsbmid()), TbRwTask::getSsbmid, dto.getSsbmid())
|
||||
.last(" and DATE_FORMAT(rwfqsj,'%Y-%m-%d')" +
|
||||
" between DATE_FORMAT('" + d + "','%Y-%m-%d')" +
|
||||
" and DATE_FORMAT(now(),'%Y-%m-%d')")
|
||||
);
|
||||
vo.setAll(all);
|
||||
vo.setJxz(jxz);
|
||||
vo.setCqjxz(cqjxz);
|
||||
vo.setCqwc(cqwc);
|
||||
vo.setYwc(ywc);
|
||||
vo.setCqwwc(cqwwc);
|
||||
ret.add(vo);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbRwTaskRankingVo> getTaskRanking(TbRwTaskStatisticsDto dto) {
|
||||
return tbRwTaskMapper.getTaskRanking(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeState() {
|
||||
// 任务到期之后还能继续执行的任务,修改状态为超期进行中
|
||||
List<TbRwTask> list = this.baseMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getXtSjzt, "1")
|
||||
.eq(TbRwTask::getRwjxzt, "1")
|
||||
.le(TbRwTask::getRwyqwcsj, DateUtils.getQueryDateString(new Date(), "02"))
|
||||
.eq(TbRwTask::getSfaqwc, "0")
|
||||
);
|
||||
list.forEach(item -> {
|
||||
item.setRwjxzt("2");
|
||||
this.baseMapper.updateById(item);
|
||||
});
|
||||
List<TbRwTaskUser> userList = this.tbRwTaskUserMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(TbRwTaskUser::getXtSjzt, "1")
|
||||
.eq(TbRwTaskUser::getRwjxzt, "1")
|
||||
.le(TbRwTaskUser::getRwyqwcsj, DateUtils.getQueryDateString(new Date(), "02"))
|
||||
.eq(TbRwTaskUser::getSfaqwc, "0")
|
||||
);
|
||||
userList.forEach(item -> {
|
||||
item.setRwjxzt("2");
|
||||
this.tbRwTaskUserMapper.updateById(item);
|
||||
});
|
||||
List<TbRwTaskUserAll> userAllList = this.tbRwTaskUserAllMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUserAll>()
|
||||
.eq(TbRwTaskUserAll::getXtSjzt, "1")
|
||||
.eq(TbRwTaskUserAll::getRwjxzt, "1")
|
||||
.le(TbRwTaskUserAll::getRwyqwcsj, DateUtils.getQueryDateString(new Date(), "02"))
|
||||
.eq(TbRwTaskUserAll::getSfaqwc, "0")
|
||||
);
|
||||
userAllList.forEach(item -> {
|
||||
item.setRwjxzt("2");
|
||||
this.tbRwTaskUserAllMapper.updateById(item);
|
||||
});
|
||||
// 任务到期之后不能继续执行的任务,修改状态为超期未完成
|
||||
list = this.baseMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getXtSjzt, "1")
|
||||
.eq(TbRwTask::getRwjxzt, "1")
|
||||
.le(TbRwTask::getRwyqwcsj, DateUtils.getQueryDateString(new Date(), "02"))
|
||||
.eq(TbRwTask::getSfaqwc, "1")
|
||||
);
|
||||
list.forEach(item -> {
|
||||
item.setRwjxzt("5");
|
||||
this.baseMapper.updateById(item);
|
||||
});
|
||||
userAllList = this.tbRwTaskUserAllMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUserAll>()
|
||||
.eq(TbRwTaskUserAll::getXtSjzt, "1")
|
||||
.eq(TbRwTaskUserAll::getRwjxzt, "1")
|
||||
.le(TbRwTaskUserAll::getRwyqwcsj, DateUtils.getQueryDateString(new Date(), "02"))
|
||||
.eq(TbRwTaskUserAll::getSfaqwc, "1")
|
||||
);
|
||||
userAllList.forEach(item -> {
|
||||
item.setRwjxzt("5");
|
||||
this.tbRwTaskUserAllMapper.updateById(item);
|
||||
});
|
||||
// 删除进行中表的任务
|
||||
userList = this.tbRwTaskUserMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(TbRwTaskUser::getXtSjzt, "1")
|
||||
.eq(TbRwTaskUser::getRwjxzt, "1")
|
||||
.le(TbRwTaskUser::getRwyqwcsj, DateUtils.getQueryDateString(new Date(), "02"))
|
||||
.eq(TbRwTaskUser::getSfaqwc, "1")
|
||||
);
|
||||
userList.forEach(item -> this.tbRwTaskUserMapper.deleteEntity(item.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbRwTask getRwByYwid(TbRwTaskByYwidQuery dto) {
|
||||
return this.baseMapper.selectOne(
|
||||
new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getYwid, dto.getYwid())
|
||||
.eq(TbRwTask::getRwxl, dto.getRwxl())
|
||||
.last(" limit 1")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbRwTaskRankingVo> getTaskByDept() {
|
||||
List<TbRwTaskRankingVo> rList = new ArrayList<>();
|
||||
List<Map<String, Object>> list = this.baseMapper.getTaskByDept();
|
||||
list.forEach(item -> {
|
||||
TbRwTaskRankingVo vo = new TbRwTaskRankingVo();
|
||||
vo.setSsbm(item.get("ssbm").toString());
|
||||
// 完成数
|
||||
int ys = this.baseMapper.getCountByDept(item.get("ssbmdm").toString(), "1");
|
||||
// 未完成数
|
||||
int ns = this.baseMapper.getCountByDept(item.get("ssbmdm").toString(), "2");
|
||||
vo.setYS(String.valueOf(ys));
|
||||
vo.setNS(String.valueOf(ns));
|
||||
vo.setRate(String.valueOf(
|
||||
ns + ys == 0 ? "0.0000" :
|
||||
(new BigDecimal(String.valueOf(ys)).divide(new BigDecimal(String.valueOf(ns))
|
||||
.add(new BigDecimal(String.valueOf(ys))), 4, BigDecimal.ROUND_HALF_UP))
|
||||
));
|
||||
rList.add(vo);
|
||||
});
|
||||
rList.sort((o1, o2) -> new BigDecimal(o2.getRate()).compareTo(new BigDecimal(o1.getRate())));
|
||||
if (rList.size() >= 10) {
|
||||
return rList.subList(0, 10);
|
||||
} else {
|
||||
return rList;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkMyTask(String id) {
|
||||
UserInfo user = UserInfoManager.get();
|
||||
|
||||
TbRwTaskUserAll taskUser = this.tbRwTaskUserAllMapper.selectByRwId(user.getIdEntityCard(), id, String.valueOf(user.getDeptId()));
|
||||
return taskUser != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void changeTaskStateByZlid(TbZlxx zl) {
|
||||
TbRwTask task = this.baseMapper.selectById(
|
||||
new LambdaQueryWrapper<TbRwTask>()
|
||||
.eq(TbRwTask::getXtSjzt, "1")
|
||||
.eq(TbRwTask::getYwid, zl.getId())
|
||||
.eq(TbRwTask::getRwxxlx, "01")
|
||||
.orderByDesc(TbRwTask::getRwfqsj)
|
||||
.last(" limit 1")
|
||||
);
|
||||
task.setYwid(zl.getId());
|
||||
task.setRwmc(zl.getZlbt());
|
||||
task.setRwnr(zl.getZlnr());
|
||||
task.setRwfqsj(zl.getZlfqsj());
|
||||
task.setSfaqwc("1");
|
||||
task.setRwyqwcsj(DateUtils.getNextDate(new Date(), "H", 1));
|
||||
task.setRwjxzt("01");
|
||||
this.baseMapper.updateById(task);
|
||||
List<TbRwTaskUser> userList = this.tbRwTaskUserMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUser>()
|
||||
.eq(TbRwTaskUser::getRwid, zl.getId())
|
||||
.eq(TbRwTaskUser::getXtSjzt, "1")
|
||||
);
|
||||
userList.forEach(item -> {
|
||||
item.setYwid(zl.getId());
|
||||
item.setRwmc(zl.getZlbt());
|
||||
item.setRwnr(zl.getZlnr());
|
||||
item.setRwfqsj(zl.getZlfqsj());
|
||||
item.setSfaqwc("1");
|
||||
item.setRwyqwcsj(DateUtils.getNextDate(new Date(), "H", 1));
|
||||
item.setRwjxzt("01");
|
||||
item.setGrrwzt("01");
|
||||
this.tbRwTaskUserMapper.updateById(item);
|
||||
});
|
||||
List<TbRwTaskUserAll> userAllList = this.tbRwTaskUserAllMapper.selectList(
|
||||
new LambdaQueryWrapper<TbRwTaskUserAll>()
|
||||
.eq(TbRwTaskUserAll::getRwid, zl.getId())
|
||||
.eq(TbRwTaskUserAll::getXtSjzt, "1")
|
||||
);
|
||||
userAllList.forEach(item -> {
|
||||
item.setYwid(zl.getId());
|
||||
item.setRwmc(zl.getZlbt());
|
||||
item.setRwnr(zl.getZlnr());
|
||||
item.setRwfqsj(zl.getZlfqsj());
|
||||
item.setSfaqwc("1");
|
||||
item.setRwyqwcsj(DateUtils.getNextDate(new Date(), "H", 1));
|
||||
item.setRwjxzt("01");
|
||||
item.setGrrwzt("01");
|
||||
this.tbRwTaskUserAllMapper.updateById(item);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getYclTask() {
|
||||
UserInfo user = UserInfoManager.get();
|
||||
|
||||
return this.baseMapper.getYclTask(user.getIdEntityCard(), String.valueOf(user.getDeptId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<TbRwTaskUserAll> getYclTaskList(TbRwTaskMyInnerQuery dto) {
|
||||
if (!StringUtils.isEmpty(dto.getKssj())) {
|
||||
dto.setKssj(dto.getKssj() + " 00:00:00");
|
||||
}
|
||||
if (!StringUtils.isEmpty(dto.getJssj())) {
|
||||
dto.setJssj(dto.getJssj() + " 00:00:00");
|
||||
}
|
||||
UserInfo userInfo = UserInfoManager.get();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageIndex", (dto.getPageCurrent() - 1) * dto.getPageSize());
|
||||
map.put("pageSize", dto.getPageSize());
|
||||
map.put("sfzh", userInfo.getIdEntityCard());
|
||||
map.put("dto", dto);
|
||||
map.put("ssbmid", String.valueOf(userInfo.getDeptId()));
|
||||
List<TbRwTaskUserAll> list = this.baseMapper.getMyRwListYwc(map);
|
||||
int count = this.baseMapper.getMyRwCountYwc(map);
|
||||
IPage<TbRwTaskUserAll> page = new Page<>(dto.getPageCurrent(), dto.getPageSize());
|
||||
page.setRecords(list);
|
||||
page.setTotal(count);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkHasNewTask(String sfzh) {
|
||||
SysUser user = this.tbBaseAdaptRemoteService.getUserInfoBySfzh(sfzh);
|
||||
if (user == null) return false;
|
||||
DeptInfoVo dept = this.tbBaseAdaptRemoteService.getDeptInfoByUserId(String.valueOf(user.getId()));
|
||||
if (dept == null || StringUtils.isEmpty(dept.getDeptid())) return false;
|
||||
Date time = DateUtils.getNextDate(new Date(), "S", -21);
|
||||
int count = this.baseMapper.checkHasNewTask(sfzh, dept.getDeptid(), DateUtils.getQueryDateString(time, "02"));
|
||||
return count >= 1;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.mosty.rwzx.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.mosty.base.model.dto.rwzx.TbRwTaskChangeStateByYwidDto;
|
||||
import com.mosty.base.model.dto.rwzx.TbRwTaskChangeStateInnerDto;
|
||||
import com.mosty.base.model.dto.rwzx.TbRwTaskGrChangeStateInnerDto;
|
||||
import com.mosty.base.model.dto.rwzx.TbRwTaskInnerDto;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUser;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskInnerQuery;
|
||||
import com.mosty.base.model.query.rwzx.TbRwTaskMyInnerQuery;
|
||||
import com.mosty.base.model.vo.rwzx.TbRwTaskMyVo;
|
||||
import com.mosty.base.model.vo.rwzx.TbRwTaskVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface TbRwTaskInnerService {
|
||||
|
||||
@ApiOperation("添加任务")
|
||||
int addRw(TbRwTaskInnerDto dto);
|
||||
|
||||
@ApiOperation("查询任务列表")
|
||||
IPage<TbRwTaskVo> selectPage(TbRwTaskInnerQuery dto);
|
||||
|
||||
@ApiOperation("查询我的任务列表")
|
||||
IPage<TbRwTaskUser> selectMyPage(TbRwTaskMyInnerQuery dto);
|
||||
|
||||
@ApiOperation("修改个人任务状态")
|
||||
void changeGrrwState(TbRwTaskGrChangeStateInnerDto dto);
|
||||
|
||||
@ApiOperation("修改任务状态")
|
||||
void changeRwState(TbRwTaskChangeStateInnerDto dto);
|
||||
|
||||
@ApiOperation("根据业务ID和业务类型修改任务状态")
|
||||
void changeStateByYwid(TbRwTaskChangeStateByYwidDto dto);
|
||||
|
||||
@ApiOperation("APP统计我的任务数量")
|
||||
List<Map<String, Object>> myRwCount();
|
||||
|
||||
@ApiOperation("APP统计任务列表的数量")
|
||||
List<Map<String, Object>> rwCountByState(TbRwTaskInnerQuery dto);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.mosty.rwzx.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.mosty.base.model.dto.rwzx.*;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTask;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUser;
|
||||
import com.mosty.base.model.entity.rwzx.TbRwTaskUserAll;
|
||||
import com.mosty.base.model.entity.yjzl.TbZlxx;
|
||||
import com.mosty.base.model.query.rwzx.*;
|
||||
import com.mosty.base.model.vo.rwzx.*;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TbRwTaskService {
|
||||
|
||||
@ApiOperation("添加任务信息")
|
||||
int addRw(TbRwTaskDto dto);
|
||||
|
||||
@ApiOperation("通过任务Id查询任务详情信息")
|
||||
TbRwTaskVo getTaskInfo(String id);
|
||||
|
||||
@ApiOperation("查询消息接收人列表")
|
||||
IPage<TbRwTaskUserVo> getTaskUserList(TbRwTaskUserQuery dto);
|
||||
|
||||
@ApiOperation("查询任务日志列表")
|
||||
IPage<TbRwTaskLogVo> getTaskLogList(TbRwTaskLogQuery dto);
|
||||
|
||||
@ApiOperation("任务中心首页数量统计接口")
|
||||
TbRwTaskStatisticsVo getDataStatistics(TbRwTaskStatisticsDto dto);
|
||||
|
||||
@ApiOperation("任务中心首页任务类型数量统计接口")
|
||||
List<TbRwTaskLXStatisticsVo> getRWLXDataStatistics(TbRwTaskStatisticsDto dto);
|
||||
|
||||
@ApiOperation("任务中心首页人员任务完成情况排名接口")
|
||||
List<TbRwTaskRankingVo> getTaskRanking(TbRwTaskStatisticsDto dto);
|
||||
|
||||
@ApiOperation("查询所有未超期的任务,判断是否超期")
|
||||
void changeState();
|
||||
|
||||
@ApiOperation("根据任务类型和业务Id查询任务是否存在")
|
||||
TbRwTask getRwByYwid(TbRwTaskByYwidQuery dto);
|
||||
|
||||
@ApiOperation("任务中心首页部门任务完成情况排名接口")
|
||||
List<TbRwTaskRankingVo> getTaskByDept();
|
||||
|
||||
@ApiOperation("查询任务是否是登录人的任务")
|
||||
Boolean checkMyTask(String id);
|
||||
|
||||
@ApiOperation("修改指令任务状态为未完成")
|
||||
void changeTaskStateByZlid(TbZlxx zl);
|
||||
|
||||
@ApiOperation("查询登录用户的已处理的任务数量")
|
||||
Integer getYclTask();
|
||||
|
||||
@ApiOperation("查询登录用户的已处理的任务列表")
|
||||
IPage<TbRwTaskUserAll> getYclTaskList(TbRwTaskMyInnerQuery dto);
|
||||
|
||||
@ApiOperation("查询是否有新的指令任务")
|
||||
boolean checkHasNewTask(String sfzh);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.mosty.rwzx.task;
|
||||
|
||||
import com.mosty.rwzx.service.TbRwTaskService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 每隔几分钟执行一次指令的修改与变更
|
||||
* 查询是否有任务已经超期
|
||||
*/
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class ChangeRwztTask {
|
||||
|
||||
private final TbRwTaskService tbRwTaskService;
|
||||
|
||||
@Scheduled(cron = "0 */5 * * * ?")
|
||||
public void run() {
|
||||
this.tbRwTaskService.changeState();
|
||||
}
|
||||
}
|
75
mosty-rwzx/src/main/resources/application.yml
Normal file
75
mosty-rwzx/src/main/resources/application.yml
Normal file
@ -0,0 +1,75 @@
|
||||
ribbon:
|
||||
ReadTimeout: 600000
|
||||
ConnectTimeout: 600000
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
jackson:
|
||||
serialization:
|
||||
write-dates-as-timestamps: false
|
||||
# # 格式化返回时间 yyyy-MM-dd HH:mm:ss
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.200.131:3306/mosty_rwzx?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: mosty888
|
||||
hikari:
|
||||
minimum-idle: 10 # ??????????10???0???maximum-pool-size??????maximum-pool-size
|
||||
maximum-pool-size: 20 # ??????????0????????10??????1?????minimum-idle??
|
||||
idle-timeout: 500000 # ????????????600000?10????????max-lifetime?max-lifetime>0??????0????0???10???????10??
|
||||
max-lifetime: 540000 # ????????????0???30??????????30??.?????mysql????????
|
||||
connection-timeout: 60000 # ????????????250????????????30?
|
||||
connection-test-query: SELECT 1 # ???????????????
|
||||
# Redis数据库索引(默认为0)
|
||||
redis:
|
||||
database: 8
|
||||
# Redis服务器地址
|
||||
host: 192.168.200.131
|
||||
# Redis服务器连接端口
|
||||
port: 6379
|
||||
# Redis服务器连接密码(默认为空)
|
||||
password: mosty888
|
||||
# 连接超时时间(毫秒)
|
||||
timeout: 2000
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 50
|
||||
|
||||
swagger:
|
||||
host: 80.155.0.84
|
||||
port: 8010
|
||||
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
magic-api:
|
||||
web: /magic/web
|
||||
#配置文件存储位置。当以classpath开头时,为只读模式
|
||||
resource:
|
||||
# location: /data/magic-api
|
||||
type: database
|
||||
table-name: magic_api # 数据库中的表名
|
||||
prefix: /magic-api # 前缀
|
||||
datasource:
|
||||
response-code:
|
||||
success: 10000
|
||||
exclude:
|
||||
pathPatterns:
|
||||
swagger:
|
||||
- /swagger-resources/**
|
||||
- /webjars/**
|
||||
- /v2/**
|
||||
- /swagger-ui.html/**
|
||||
- /docs.html/**
|
||||
|
||||
config:
|
||||
orgCode: 510600000000
|
39
mosty-rwzx/src/main/resources/bootstrap.yml
Normal file
39
mosty-rwzx/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,39 @@
|
||||
server:
|
||||
port: 8020
|
||||
servlet:
|
||||
context-path: /mosty-rwzx/
|
||||
spring:
|
||||
application:
|
||||
name: mosty-rwzx
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
namespace: 657d1843-b590-41ac-b5e7-5d261bf00de9
|
||||
server-addr: 192.168.200.131:8848
|
||||
register-enabled: true # 是否将自己注册到配置中心,让其他服务发现调用(本地调试使用)
|
||||
|
||||
|
||||
# 开启健康监控
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
auditevents:
|
||||
enabled: true
|
||||
|
||||
#swagger:
|
||||
# enable: true
|
||||
# title: 基础微服务
|
||||
# version: 1.0.0
|
||||
# name: 基础微服务
|
||||
# url: ''
|
||||
# email: ''
|
||||
|
||||
# 日志
|
||||
#logging:
|
||||
# file: /application/applogs/admin.log
|
||||
|
114
mosty-rwzx/src/main/resources/logback-spring.xml
Normal file
114
mosty-rwzx/src/main/resources/logback-spring.xml
Normal file
@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<jmxConfigurator/>
|
||||
<property name="PROJECT_NAME" value="msxf-retail-sort" />
|
||||
<property name="LOG_FILE_INFO" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-info.log" />
|
||||
<property name="LOG_FILE_WARN" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-warn.log" />
|
||||
<property name="LOG_FILE_ERR" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/msxf-retail-sort-error.log" />
|
||||
<property name="LOG_BUSINESS" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/business/business-2de.log"/>
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
|
||||
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
|
||||
<contextName>${PROJECT_NAME}</contextName>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<appender name="LOG_FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
|
||||
</encoder>
|
||||
<file>${LOG_FILE_INFO}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_INFO}-7de.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>1024MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="LOG_FILE_WARN"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>WARN</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
|
||||
</encoder>
|
||||
<file>${LOG_FILE_WARN}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_WARN}-30de.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>1024MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<appender name="LOG_FILE_ERROR"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
|
||||
</encoder>
|
||||
<file>${LOG_FILE_ERR}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_FILE_ERR}.%d{yyyy-MM-dd}.%i</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>512MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
</appender>
|
||||
|
||||
<!--添加监控日志 -->
|
||||
<appender name="business-log-appender"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>info</level>
|
||||
</filter>
|
||||
<file>${LOG_BUSINESS}</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_BUSINESS}.%d{yyyy-MM-dd}.%i
|
||||
</fileNamePattern>
|
||||
<maxFileSize>1024MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="business-log" additivity="false" level="info">
|
||||
<appender-ref ref="business-log-appender"/>
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</logger>
|
||||
<!-- show parameters for hibernate sql 专为 Hibernate 定制 -->
|
||||
<logger name="logging.level.jdbc" level="INFO" />
|
||||
<logger name="logging.level.jdbc.sqlonly" level="INFO" />
|
||||
<logger name="org.springframework" level="INFO" additivity="true" />
|
||||
<Logger name="jdbc.sqlonly" level="info" />
|
||||
<Logger name="jdbc.sqltiming" level="warn" />
|
||||
<Logger name="jdbc.audit" level="warn" />
|
||||
<Logger name="jdbc.resultset" level="warn" />
|
||||
<Logger name="jdbc.resultsettable" level="warn" />
|
||||
<logger name="jdbc.connection" level="warn" />
|
||||
<Logger name="log4jdbc.debug" level="warn" />
|
||||
<Logger name="org.apache.kafka.clients.NetworkClient" level="ERROR" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
<appender-ref ref="LOG_FILE_INFO" />
|
||||
<appender-ref ref="LOG_FILE_WARN" />
|
||||
<appender-ref ref="LOG_FILE_ERROR" />
|
||||
</root>
|
||||
</configuration>
|
78
mosty-rwzx/src/main/resources/mapper/TbRwTaskLogMapper.xml
Normal file
78
mosty-rwzx/src/main/resources/mapper/TbRwTaskLogMapper.xml
Normal file
@ -0,0 +1,78 @@
|
||||
<?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.mosty.rwzx.mapper.TbRwTaskLogMapper">
|
||||
<resultMap type="com.mosty.base.model.entity.rwzx.TbRwTaskLog" id="tbRwTaskLog">
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="rwid" column="sjlyid" jdbcType="VARCHAR"/>
|
||||
<result property="rzlx" column="jkdbgbh" jdbcType="VARCHAR"/>
|
||||
<result property="rznr" column="sbbh" jdbcType="VARCHAR"/>
|
||||
<result property="jd" column="jd" jdbcType="NUMERIC"/>
|
||||
<result property="wd" column="wd" jdbcType="NUMERIC"/>
|
||||
<result property="zb" column="zb" typeHandler="com.mosty.base.feign.handle.PointTypeHandler"/>
|
||||
<result property="zbhash" column="zbhash" jdbcType="VARCHAR"/>
|
||||
<result property="bgsj" column="bgsj" jdbcType="TIMESTAMP"/>
|
||||
<result property="bgrid" column="xzqhdm" jdbcType="VARCHAR"/>
|
||||
<result property="bgrxm" column="dzmc" jdbcType="VARCHAR"/>
|
||||
<result property="bgrsfzh" column="sblxdm" jdbcType="VARCHAR"/>
|
||||
<result property="bgrdhhm" column="sjlxdm" jdbcType="VARCHAR"/>
|
||||
<result property="ssbm" column="ssbm" jdbcType="VARCHAR"/>
|
||||
<result property="ssbmdm" column="ssbmdm" jdbcType="VARCHAR"/>
|
||||
<result property="ssbmid" column="ssbmid" jdbcType="VARCHAR"/>
|
||||
<result property="ssxgaj" column="ssxgaj" jdbcType="VARCHAR"/>
|
||||
<result property="ssxgajdm" column="ssxgajdm" jdbcType="VARCHAR"/>
|
||||
<result property="ssxgajid" column="ssxgajid" jdbcType="VARCHAR"/>
|
||||
<result property="sssgaj" column="sssgaj" jdbcType="VARCHAR"/>
|
||||
<result property="sssgajdm" column="sssgajdm" jdbcType="VARCHAR"/>
|
||||
<result property="sssgajid" column="sssgajid" jdbcType="VARCHAR"/>
|
||||
<result property="xtSjly" column="xt_sjly" jdbcType="VARCHAR"/>
|
||||
<result property="xtSjzt" column="xt_sjzt" jdbcType="VARCHAR"/>
|
||||
<result property="xtScbz" column="xt_scbz" jdbcType="VARCHAR"/>
|
||||
<result property="xtCjip" column="xt_cjip" jdbcType="VARCHAR"/>
|
||||
<result property="xtCjsj" column="xt_cjsj" jdbcType="TIMESTAMP"/>
|
||||
<result property="xtCjrId" column="xt_cjr_id" jdbcType="VARCHAR"/>
|
||||
<result property="xtCjr" column="xt_cjr" jdbcType="VARCHAR"/>
|
||||
<result property="xtCjbmdm" column="xt_cjbmdm" jdbcType="VARCHAR"/>
|
||||
<result property="xtCjbmmc" column="xt_cjbmmc" jdbcType="VARCHAR"/>
|
||||
<result property="xtZhgxip" column="xt_zhgxip" jdbcType="VARCHAR"/>
|
||||
<result property="xtZhgxsj" column="xt_zhgxsj" jdbcType="TIMESTAMP"/>
|
||||
<result property="xtZhgxrid" column="xt_zhgxrid" jdbcType="VARCHAR"/>
|
||||
<result property="xtZhgxr" column="xt_zhgxr" jdbcType="VARCHAR"/>
|
||||
<result property="xtZhgxbmdm" column="xt_zhgxbmdm" jdbcType="VARCHAR"/>
|
||||
<result property="xtZhgxbm" column="xt_zhgxbm" jdbcType="VARCHAR"/>
|
||||
<result property="bz" column="bz" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="base_column_list">
|
||||
|
||||
id,rwid,rzlx,rznr,jd,wd,zbhash,bgsj,bgrid,bgrxm,bgrsfzh,bgrdhhm,ssbmid,ssxgajid,sssgajid,
|
||||
ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz,
|
||||
xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
|
||||
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz
|
||||
|
||||
</sql>
|
||||
|
||||
<sql id="zb_sql">
|
||||
|
||||
ST_ASWKT
|
||||
(zb) as zb
|
||||
|
||||
</sql>
|
||||
|
||||
<insert id="insertEntity" parameterType="com.mosty.base.model.entity.rwzx.TbRwTaskLog">
|
||||
|
||||
insert into tb_rw_task_log(
|
||||
id,rwid,rzlx,rznr,jd,wd,zb,zbhash,bgsj,bgrid,bgrxm,bgrsfzh,bgrdhhm,ssbmid,ssxgajid,sssgajid,
|
||||
ssbm, ssbmdm, ssxgaj, ssxgajdm, sssgaj, sssgajdm, xt_sjly, xt_sjzt, xt_scbz,
|
||||
xt_cjip, xt_cjsj, xt_cjr_id, xt_cjr, xt_cjbmdm, xt_cjbmmc, xt_zhgxip, xt_zhgxsj, xt_zhgxrid,
|
||||
xt_zhgxr, xt_zhgxbmdm, xt_zhgxbm, bz
|
||||
)values (
|
||||
#{id},#{rwid},#{rzlx},#{rznr},#{jd},#{wd},
|
||||
ST_GEOMFROMTEXT(#{zb,typeHandler = com.mosty.base.feign.handle.PointTypeHandler}),
|
||||
#{zbhash},#{bgsj},#{bgrid},#{bgrxm},#{bgrsfzh},#{bgrdhhm},#{ssbmid},#{ssxgajid},#{sssgajid},
|
||||
#{ssbm}, #{ssbmdm}, #{ssxgaj}, #{ssxgajdm}, #{sssgaj}, #{sssgajdm}, #{xtSjly}, #{xtSjzt}, #{xtScbz},
|
||||
#{xtCjip}, #{xtCjsj}, #{xtCjrId}, #{xtCjr}, #{xtCjbmdm}, #{xtCjbmmc}, #{xtZhgxip}, #{xtZhgxsj},
|
||||
#{xtZhgxrid},#{xtZhgxr}, #{xtZhgxbmdm}, #{xtZhgxbm}, #{bz}
|
||||
)
|
||||
|
||||
</insert>
|
||||
</mapper>
|
354
mosty-rwzx/src/main/resources/mapper/TbRwTaskMapper.xml
Normal file
354
mosty-rwzx/src/main/resources/mapper/TbRwTaskMapper.xml
Normal file
@ -0,0 +1,354 @@
|
||||
<?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.mosty.rwzx.mapper.TbRwTaskMapper">
|
||||
<select id="selectDict" resultType="com.mosty.common.config.entity.SysDictItem">
|
||||
select *
|
||||
from mosty_base.sys_dict_item
|
||||
where zdbh = #{dictName}
|
||||
and xt_zxbz = '0'
|
||||
</select>
|
||||
|
||||
<select id="getTaskRanking" parameterType="com.mosty.base.model.dto.rwzx.TbRwTaskStatisticsDto"
|
||||
resultType="com.mosty.base.model.vo.rwzx.TbRwTaskRankingVo">
|
||||
select userinfo.jsrsfzh,
|
||||
userinfo.jsrmc,
|
||||
ssbm,
|
||||
IFNULL(YTable.YS, '0') YS,
|
||||
IFNULL(NTable.NS, '0') NS,
|
||||
(IFNULL( YTable.YS,0) / ( IFNULL( YTable.YS,0) + IFNULL( NTable.NS,0) )) rate
|
||||
from (select jsrsfzh, jsrmc, ssbm
|
||||
from mosty_rwzx.tb_rw_task_user
|
||||
WHERE xt_sjzt = '1' and xt_scbz = '0'
|
||||
<if test="ssbmid != null and ssbmid != ''">
|
||||
and ssbmid = #{ssbmid}
|
||||
</if>
|
||||
|
||||
GROUP BY jsrsfzh, jsrmc, ssbm) userinfo
|
||||
LEFT JOIN (SELECT jsrsfzh,
|
||||
sum(s) YS
|
||||
FROM (SELECT i.dm, u.jsrsfzh, count(u.id) s
|
||||
FROM mosty_base.sys_dict_item i
|
||||
left JOIN (select *
|
||||
from mosty_rwzx.tb_rw_task_user
|
||||
where xt_sjzt = '1' and xt_scbz = '0') u on i.dm = u.rwzt
|
||||
where i.zdbh = 'D_BZ_GRRWZT'
|
||||
and i.xt_zxbz = '0'
|
||||
GROUP BY i.dm, u.jsrsfzh
|
||||
ORDER BY i.dm) g
|
||||
WHERE dm = '2'
|
||||
GROUP BY jsrsfzh) YTable on userinfo.jsrsfzh = YTable.jsrsfzh
|
||||
LEFT JOIN (SELECT jsrsfzh,
|
||||
sum(s) NS
|
||||
FROM (SELECT i.dm, u.jsrsfzh, count(u.id) s
|
||||
FROM mosty_base.sys_dict_item i
|
||||
left JOIN (select *
|
||||
from mosty_rwzx.tb_rw_task_user
|
||||
where xt_sjzt = '1' and xt_scbz = '0') u on i.dm = u.rwzt
|
||||
where i.zdbh = 'D_BZ_GRRWZT'
|
||||
and i.xt_zxbz = '0'
|
||||
GROUP BY i.dm, u.jsrsfzh
|
||||
ORDER BY i.dm) g
|
||||
WHERE dm != '2'
|
||||
GROUP BY
|
||||
jsrsfzh) NTable on userinfo.jsrsfzh = NTable.jsrsfzh
|
||||
order by rate DESC LIMIT 0,10
|
||||
</select>
|
||||
|
||||
<!--获取我的任务列表-->
|
||||
<select id="getMyRwList" resultType="com.mosty.base.model.entity.rwzx.TbRwTaskUser">
|
||||
select * from tb_rw_task_user a where a.xt_scbz = '0' and a.xt_sjzt = '1'
|
||||
<if test="dto.kssj != null and dto.jssj != null and dto.kssj != '' and dto.jssj != ''">
|
||||
and a.rwfqsj > #{kssj}
|
||||
and a.rwfqsj < #{jssj}
|
||||
</if>
|
||||
<if test="dto.rwxl != null and dto.rwxl != ''">
|
||||
and a.rwxl = #{dto.rwxl}
|
||||
</if>
|
||||
<if test="dto.rwmc != null and dto.rwmc != ''">
|
||||
and a.rwmc like concat('%',#{dto.rwmc},'%')
|
||||
</if>
|
||||
<if test="dto.rwnr != null and dto.rwnr != ''">
|
||||
and a.rwnr like concat('%',#{dto.rwnr},'%')
|
||||
</if>
|
||||
<if test="dto.rwlx != null and dto.rwlx != ''">
|
||||
and a.rwlx = #{dto.rwlx}
|
||||
</if>
|
||||
<if test="dto.rwjjcd != null and dto.rwjjcd != ''">
|
||||
and a.rwjjcd = #{dto.rwjjcd}
|
||||
</if>
|
||||
<if test="dto.rwzt != null and dto.rwzt != ''">
|
||||
and a.rwzt = #{dto.rwzt}
|
||||
</if>
|
||||
and case
|
||||
when a.rwjsdx = '01' then a.jsrsfzh = #{sfzh}
|
||||
|
||||
when a.rwjsdx = '02' then a.jsbmdm = #{ssbmid}
|
||||
|
||||
when a.rwjsdx = '03' then
|
||||
a.jsxzid in (select c.id from mosty_qwgl.tb_qw_xfbb c,mosty_qwgl.tb_qw_jl d where c.id = d.ywid and
|
||||
c.xt_sjzt = '1' and c.xt_scbz = '0' and d.xt_sjzt = '1' and d.xt_scbz = '0' and
|
||||
(c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
end
|
||||
<if test="dto.grrwzt != null and dto.grrwzt != ''">
|
||||
and a.grrwzt = #{dto.grrwzt}
|
||||
</if>
|
||||
order by a.rwfqsj desc
|
||||
limit #{pageIndex},#{pageSize}
|
||||
</select>
|
||||
|
||||
<!--获取我的任务的数量-->
|
||||
<select id="getMyRwCount" resultType="java.lang.Integer">
|
||||
select count(1) from tb_rw_task a where a.xt_scbz = '0' and a.xt_sjzt = '1'
|
||||
<if test="dto.kssj != null and dto.jssj != null and dto.kssj != '' and dto.jssj != ''">
|
||||
and a.rwfqsj > #{kssj}
|
||||
and a.rwfqsj < #{jssj}
|
||||
</if>
|
||||
<if test="dto.rwmc != null and dto.rwmc != ''">
|
||||
and a.rwmc like concat('%',#{dto.rwmc},'%')
|
||||
</if>
|
||||
<if test="dto.rwnr != null and dto.rwnr != ''">
|
||||
and a.rwnr like concat('%',#{dto.rwnr},'%')
|
||||
</if>
|
||||
<if test="dto.rwxl != null and dto.rwxl != ''">
|
||||
and a.rwxl = #{dto.rwxl}
|
||||
</if>
|
||||
<if test="dto.rwlx != null and dto.rwlx != ''">
|
||||
and a.rwlx = #{dto.rwlx}
|
||||
</if>
|
||||
<if test="dto.rwjjcd != null and dto.rwjjcd != ''">
|
||||
and a.rwjjcd = #{dto.rwjjcd}
|
||||
</if>
|
||||
<if test="dto.rwzt != null and dto.rwzt != ''">
|
||||
and a.rwzt = #{dto.rwzt}
|
||||
</if>
|
||||
and a.id in (
|
||||
select rwid from tb_rw_task_user b where b.xt_scbz = '0' and b.xt_sjzt = '1'
|
||||
and case
|
||||
when b.rwjsdx = '01' then b.jsrsfzh = #{sfzh}
|
||||
|
||||
when b.rwjsdx = '02' then b.jsbmdm = #{ssbmid}
|
||||
|
||||
when b.rwjsdx = '03' then
|
||||
b.jsxzid in (select c.id from mosty_qwgl.tb_qw_xfbb c,mosty_qwgl.tb_qw_jl d where c.id = d.ywid and
|
||||
c.xt_sjzt = '1' and c.xt_scbz = '0' and d.xt_sjzt = '1' and d.xt_scbz = '0' and
|
||||
(c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
end
|
||||
<if test="dto.grrwzt != null and dto.grrwzt != ''">
|
||||
and b.rwzt = #{dto.grrwzt}
|
||||
</if>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="getCount" resultType="java.lang.Integer">
|
||||
select count(1) from tb_rw_task a where a.xt_scbz = '0' and a.xt_sjzt = '1'
|
||||
<if test="rwjxzt != null and rwjxzt != ''">
|
||||
and a.rwjxzt = #{rwjxzt}
|
||||
</if>
|
||||
<if test="time != null">
|
||||
and DATE_FORMAT(a.rwfqsj,'%Y-%m-%d')
|
||||
between DATE_FORMAT(#{time},'%Y-%m-%d')
|
||||
and DATE_FORMAT(now(),'%Y-%m-%d')
|
||||
</if>
|
||||
<if test="sfzh != null and sfzh != ''">
|
||||
and a.id in (
|
||||
select rwid from tb_rw_task_user b where b.jsrsfzh = #{sfzh}
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getTaskByDept" resultType="Map">
|
||||
select ssbmdm, ssbm, count(ssbmdm) as count
|
||||
from tb_rw_task_user a
|
||||
where a.xt_scbz = '0'
|
||||
and a.xt_sjzt = '1'
|
||||
and a.ssbmdm is not null
|
||||
group by ssbmdm, ssbm
|
||||
order by count(ssbmdm) desc;
|
||||
</select>
|
||||
|
||||
<select id="getCountByDept" resultType="Integer">
|
||||
select count(1) from tb_rw_task_user b where b.xt_scbz = '0' and b.xt_sjzt = '1'
|
||||
and ssbmdm = #{ssbmdm}
|
||||
<if test='type == "1"'>
|
||||
and rwzt = '2'
|
||||
</if>
|
||||
<if test='type == "2"'>
|
||||
and rwzt != '2'
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="myRwCount" resultType="Map">
|
||||
select count(1) count, rwxl
|
||||
from tb_rw_task_user b
|
||||
where b.xt_scbz = '0'
|
||||
and b.xt_sjzt = '1'
|
||||
and case
|
||||
when b.rwjsdx = '01' then b.jsrsfzh = #{sfzh}
|
||||
|
||||
when b.rwjsdx = '02' then b.jsbmdm = #{ssbmid}
|
||||
|
||||
when b.rwjsdx = '03' then
|
||||
b.jsxzid in (select c.id
|
||||
from mosty_qwgl.tb_qw_xfbb c,
|
||||
mosty_qwgl.tb_qw_jl d
|
||||
where c.id = d.ywid
|
||||
and c.xt_sjzt = '1'
|
||||
and c.xt_scbz = '0'
|
||||
and d.xt_sjzt = '1'
|
||||
and d.xt_scbz = '0'
|
||||
and (c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
end
|
||||
group by rwxl
|
||||
</select>
|
||||
|
||||
<select id="rwCountByState" resultType="java.util.Map">
|
||||
select count(1) count, rwjxzt from tb_rw_task a where a.xt_scbz = '0' and a.xt_sjzt = '1'
|
||||
<if test="dto.kssj != null and dto.jssj != null and dto.kssj != '' and dto.jssj != ''">
|
||||
and a.rwfqsj > #{dto.kssj}
|
||||
and a.rwfqsj < #{dto.jssj}
|
||||
</if>
|
||||
<if test="dto.rwnr != null and dto.rwnr != ''">
|
||||
and a.rwnr like concat('%',#{dto.rwnr},'%')
|
||||
</if>
|
||||
<if test="rwxlList != null and rwxlList.size() != 0">
|
||||
and a.rwxl in
|
||||
<foreach collection="rwxlList" open="(" separator="," close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="rwjsdxList != null and rwjsdxList.size() != 0">
|
||||
and a.rwjsdx in
|
||||
<foreach collection="rwjsdxList" open="(" separator="," close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.rwzt != null and dto.rwzt != ''">
|
||||
and a.rwzt = #{dto.rwzt}
|
||||
</if>
|
||||
group by rwjxzt
|
||||
</select>
|
||||
|
||||
<select id="getYclTask" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from tb_rw_task_user_all b
|
||||
where b.xt_scbz = '0'
|
||||
and b.xt_sjzt = '1'
|
||||
and case
|
||||
when b.rwjsdx = '01' then b.jsrsfzh = #{sfzh}
|
||||
|
||||
when b.rwjsdx = '02' then b.jsbmdm = #{ssbmid}
|
||||
|
||||
when b.rwjsdx = '03' then
|
||||
b.jsxzid in (select c.id
|
||||
from mosty_qwgl.tb_qw_xfbb c,
|
||||
mosty_qwgl.tb_qw_jl d
|
||||
where c.id = d.ywid
|
||||
and c.xt_sjzt = '1'
|
||||
and c.xt_scbz = '0'
|
||||
and d.xt_sjzt = '1'
|
||||
and d.xt_scbz = '0'
|
||||
and (c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
end
|
||||
and (grrwzt = '2' or rwjxzt = '3' or rwjxzt = '4')
|
||||
</select>
|
||||
|
||||
<select id="getMyRwListYwc" resultType="com.mosty.base.model.entity.rwzx.TbRwTaskUserAll">
|
||||
select * from tb_rw_task_user_all a where a.xt_scbz = '0' and a.xt_sjzt = '1'
|
||||
<if test="dto.kssj != null and dto.jssj != null and dto.kssj != '' and dto.jssj != ''">
|
||||
and a.rwfqsj > #{kssj}
|
||||
and a.rwfqsj < #{jssj}
|
||||
</if>
|
||||
<if test="dto.rwxl != null and dto.rwxl != ''">
|
||||
and a.rwxl = #{dto.rwxl}
|
||||
</if>
|
||||
<if test="dto.rwmc != null and dto.rwmc != ''">
|
||||
and a.rwmc like concat('%',#{dto.rwmc},'%')
|
||||
</if>
|
||||
<if test="dto.rwnr != null and dto.rwnr != ''">
|
||||
and a.rwnr like concat('%',#{dto.rwnr},'%')
|
||||
</if>
|
||||
<if test="dto.rwlx != null and dto.rwlx != ''">
|
||||
and a.rwlx = #{dto.rwlx}
|
||||
</if>
|
||||
<if test="dto.rwjjcd != null and dto.rwjjcd != ''">
|
||||
and a.rwjjcd = #{dto.rwjjcd}
|
||||
</if>
|
||||
<if test="dto.rwzt != null and dto.rwzt != ''">
|
||||
and a.rwzt = #{dto.rwzt}
|
||||
</if>
|
||||
and case
|
||||
when a.rwjsdx = '01' then a.jsrsfzh = #{sfzh}
|
||||
|
||||
when a.rwjsdx = '02' then a.jsbmdm = #{ssbmid}
|
||||
|
||||
when a.rwjsdx = '03' then
|
||||
a.jsxzid in (select c.id from mosty_qwgl.tb_qw_xfbb c,mosty_qwgl.tb_qw_jl d where c.id = d.ywid and
|
||||
c.xt_sjzt = '1' and c.xt_scbz = '0' and d.xt_sjzt = '1' and d.xt_scbz = '0' and
|
||||
(c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
end
|
||||
and (grrwzt = '2' or rwjxzt = '3' or rwjxzt = '4')
|
||||
order by a.rwfqsj desc
|
||||
limit #{pageIndex},#{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="getMyRwCountYwc" resultType="integer">
|
||||
select count(1) from tb_rw_task_user_all a where a.xt_scbz = '0' and a.xt_sjzt = '1'
|
||||
<if test="dto.kssj != null and dto.jssj != null and dto.kssj != '' and dto.jssj != ''">
|
||||
and a.rwfqsj > #{kssj}
|
||||
and a.rwfqsj < #{jssj}
|
||||
</if>
|
||||
<if test="dto.rwxl != null and dto.rwxl != ''">
|
||||
and a.rwxl = #{dto.rwxl}
|
||||
</if>
|
||||
<if test="dto.rwmc != null and dto.rwmc != ''">
|
||||
and a.rwmc like concat('%',#{dto.rwmc},'%')
|
||||
</if>
|
||||
<if test="dto.rwnr != null and dto.rwnr != ''">
|
||||
and a.rwnr like concat('%',#{dto.rwnr},'%')
|
||||
</if>
|
||||
<if test="dto.rwlx != null and dto.rwlx != ''">
|
||||
and a.rwlx = #{dto.rwlx}
|
||||
</if>
|
||||
<if test="dto.rwjjcd != null and dto.rwjjcd != ''">
|
||||
and a.rwjjcd = #{dto.rwjjcd}
|
||||
</if>
|
||||
<if test="dto.rwzt != null and dto.rwzt != ''">
|
||||
and a.rwzt = #{dto.rwzt}
|
||||
</if>
|
||||
and case
|
||||
when a.rwjsdx = '01' then a.jsrsfzh = #{sfzh}
|
||||
|
||||
when a.rwjsdx = '02' then a.jsbmdm = #{ssbmid}
|
||||
|
||||
when a.rwjsdx = '03' then
|
||||
a.jsxzid in (select c.id from mosty_qwgl.tb_qw_xfbb c,mosty_qwgl.tb_qw_jl d where c.id = d.ywid and
|
||||
c.xt_sjzt = '1' and c.xt_scbz = '0' and d.xt_sjzt = '1' and d.xt_scbz = '0' and
|
||||
(c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
end
|
||||
and (grrwzt = '2' or rwjxzt = '3' or rwjxzt = '4')
|
||||
</select>
|
||||
|
||||
<select id="checkHasNewTask" resultType="int">
|
||||
select count(1)
|
||||
from tb_rw_task_user b
|
||||
where b.xt_scbz = '0'
|
||||
and b.xt_sjzt = '1'
|
||||
and case
|
||||
when b.rwjsdx = '01' then b.jsrsfzh = #{sfzh}
|
||||
|
||||
when b.rwjsdx = '02' then b.jsbmdm = #{ssbmid}
|
||||
|
||||
when b.rwjsdx = '03' then
|
||||
b.jsxzid in (select c.id
|
||||
from mosty_qwgl.tb_qw_xfbb c,
|
||||
mosty_qwgl.tb_qw_jl d
|
||||
where c.id = d.ywid
|
||||
and c.xt_sjzt = '1'
|
||||
and c.xt_scbz = '0'
|
||||
and d.xt_sjzt = '1'
|
||||
and d.xt_scbz = '0'
|
||||
and (c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
end
|
||||
and date_format(rwfqsj, '%Y-%m-%d %H:%i:%s') >= #{time}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,29 @@
|
||||
<?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.mosty.rwzx.mapper.TbRwTaskUserAllMapper">
|
||||
|
||||
<select id="selectByRwId" resultType="com.mosty.base.model.entity.rwzx.TbRwTaskUserAll">
|
||||
select *
|
||||
from tb_rw_task_user_all a
|
||||
where a.xt_scbz = '0'
|
||||
and a.xt_sjzt = '1'
|
||||
and a.rwid = #{rwid}
|
||||
and case
|
||||
when a.rwjsdx = '01' then a.jsrsfzh = #{sfzh}
|
||||
|
||||
when a.rwjsdx = '03' then
|
||||
a.jsxzid in (select c.id
|
||||
from mosty_qwgl.tb_qw_xfbb c,
|
||||
mosty_qwgl.tb_qw_jl d
|
||||
where c.id = d.ywid
|
||||
and c.xt_sjzt = '1'
|
||||
and c.xt_scbz = '0'
|
||||
and d.xt_sjzt = '1'
|
||||
and d.xt_scbz = '0'
|
||||
and (c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
|
||||
when a.rwjsdx = '02' then
|
||||
a.jsbmdm = #{ssbmid}
|
||||
end
|
||||
</select>
|
||||
</mapper>
|
34
mosty-rwzx/src/main/resources/mapper/TbRwTaskUserMapper.xml
Normal file
34
mosty-rwzx/src/main/resources/mapper/TbRwTaskUserMapper.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?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.mosty.rwzx.mapper.TbRwTaskUserMapper">
|
||||
<select id="selectByRwId" resultType="com.mosty.base.model.entity.rwzx.TbRwTaskUser">
|
||||
select *
|
||||
from tb_rw_task_user a
|
||||
where a.xt_scbz = '0'
|
||||
and a.xt_sjzt = '1'
|
||||
and a.rwid = #{rwid}
|
||||
and case
|
||||
when a.rwjsdx = '01' then a.jsrsfzh = #{sfzh}
|
||||
|
||||
when a.rwjsdx = '03' then
|
||||
a.jsxzid in (select c.id
|
||||
from mosty_qwgl.tb_qw_xfbb c,
|
||||
mosty_qwgl.tb_qw_jl d
|
||||
where c.id = d.ywid
|
||||
and c.xt_sjzt = '1'
|
||||
and c.xt_scbz = '0'
|
||||
and d.xt_sjzt = '1'
|
||||
and d.xt_scbz = '0'
|
||||
and (c.fzr_sfzh = #{sfzh} or d.sfzh = #{sfzh}))
|
||||
|
||||
when a.rwjsdx = '02' then
|
||||
a.jsbmdm = #{ssbmid}
|
||||
end
|
||||
</select>
|
||||
|
||||
<delete id="deleteEntity">
|
||||
delete
|
||||
from tb_rw_task_user
|
||||
where id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
16
mosty-rwzx/src/main/resources/rebel.xml
Normal file
16
mosty-rwzx/src/main/resources/rebel.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
|
||||
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
|
||||
-->
|
||||
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
|
||||
|
||||
<id>mosty-rwzx</id>
|
||||
|
||||
<classpath>
|
||||
<dir name="E:/project/rs/mosty-dyga-cloud/mosty-rwzx/target/classes">
|
||||
</dir>
|
||||
</classpath>
|
||||
|
||||
</application>
|
Reference in New Issue
Block a user