Commit 39e96aa6 authored by 高宇's avatar 高宇

1.月度信息

parent 5e24225f
......@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.transaction.annotation.EnableTransactionManagement;
......@@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableScheduling
@EnableGlobalMethodSecurity(prePostEnabled=true)
@MapperScan(basePackages = {"org.rcisoft.**.dao","org.activiti.dao"})//扫描dao 不需要@repository
@EnableAsync
public class DataApiApplication {
public static void main(String[] args) {
......
......@@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.bus.taskinfo.entity.TaskInfo;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.util.CyEpExcelUtil;
......@@ -151,9 +152,13 @@ public class Jnsp7xtmDqsjController extends CyPaginationController<Jnsp7xtmDqsj>
@ApiOperation(value = "月度表拉取", notes = "月度表拉取")
@PostMapping (value = "/monthlyTablePull")
public CyResult monthlyTablePull() {
return CyResultGenUtil.builder(jnsp7xtmDqsjServiceImpl.monthlyTablePull(),
//service1
TaskInfo taskInfo = jnsp7xtmDqsjServiceImpl.addTaskInfo();
//service2
jnsp7xtmDqsjServiceImpl.monthlyTablePull(taskInfo.getTackId());
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
null);
taskInfo);
}
}
......@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.bus.jnsp7xtm.dto.Jnsp7xtmOptionDto;
import org.rcisoft.bus.jnsp7xtmdqsj.entity.Jnsp7xtmDqsj;
import org.rcisoft.bus.taskinfo.entity.TaskInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.result.enums.CyResSvcExcEnum;
import java.util.List;
......@@ -79,5 +81,8 @@ public interface Jnsp7xtmDqsjService {
/**
* 流程添加
* **/
CyPersistModel monthlyTablePull();
CyPersistModel monthlyTablePull(String takeId);
// 添加任务
TaskInfo addTaskInfo();
}
......@@ -21,7 +21,10 @@ import org.rcisoft.bus.jnsp7xtm.dto.Jnsp7xtmOptionDto;
import org.rcisoft.bus.jnsp7xtm.entity.Jnsp7xtm;
import org.rcisoft.bus.jnsp7xtm.enums.ColTransitionEnum;
import org.rcisoft.bus.jnsp7xtm.vo.Jnsp7xtmVo;
import org.rcisoft.bus.taskinfo.dao.TaskInfoRepository;
import org.rcisoft.bus.taskinfo.entity.TaskInfo;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.util.CyIdGenUtil;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPersistModel;
......@@ -35,16 +38,15 @@ import org.rcisoft.util.ExcelExportStatisticStyler;
import org.rcisoft.util.ExportToExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
......@@ -66,6 +68,9 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
// 月度表拉取锁
private static Lock monthlyTablePullLock = new ReentrantLock();
@Autowired
private TaskInfoRepository taskInfoRepository;
@Value("${jnsp7xtmDqsj.batchAddPagesize}")
private Integer batchInsertSize;
......@@ -188,11 +193,12 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
}
/**
* 月度表重置
* 月度表拉取
* **/
@Override
@Async
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
public CyPersistModel monthlyTablePull() {
public CyPersistModel monthlyTablePull(String taskId) {
try {
if (monthlyTablePullLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
try {
......@@ -214,6 +220,11 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
baseMapper.batchAddJnsp7xtmDqsj(addList);
// 停止计时器
stopwatch.stop();
QueryWrapper<TaskInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tack_id",taskId);
TaskInfo taskInfo = taskInfoRepository.selectOne(queryWrapper);
taskInfo.setStatus("1");
taskInfoRepository.updateById(taskInfo);
log.info("查询耗时秒" + stopwatch.elapsed().getSeconds());
log.info("查询耗时毫秒" + stopwatch.elapsed(TimeUnit.MILLISECONDS));
} catch (Exception e) {
......@@ -232,4 +243,16 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
return new CyPersistModel(1);
}
/**添加任务**/
@Override
public TaskInfo addTaskInfo() {
TaskInfo taskInfo = new TaskInfo();
taskInfo.setStatus("0");
taskInfo.setType("jnsp7xtmDqsj");
// 生成uuid
taskInfo.setTackId(CyIdGenUtil.uuid());
taskInfoRepository.insert(taskInfo);
return taskInfo;
}
}
......@@ -56,7 +56,7 @@ public class TaskInfoController extends CyPaginationController<TaskInfo> {
@ApiOperation(value="逻辑删除?????", notes="逻辑删除?????")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/deleteLogical/{businessId:\\w+}")
public CyResult deleteLogical(@PathVariable String businessId,TaskInfo taskInfo) {
public CyResult deleteLogical(@PathVariable Integer businessId,TaskInfo taskInfo) {
taskInfo.setBusinessId(businessId);
CyPersistModel data = taskInfoServiceImpl.removeLogical(taskInfo);
return CyResultGenUtil.builder(data,
......@@ -69,7 +69,7 @@ public class TaskInfoController extends CyPaginationController<TaskInfo> {
@ApiOperation(value="删除?????", notes="删除?????")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable String businessId,TaskInfo taskInfo) {
public CyResult delete(@PathVariable Integer businessId,TaskInfo taskInfo) {
taskInfo.setBusinessId(businessId);
CyPersistModel data = taskInfoServiceImpl.remove(taskInfo);
return CyResultGenUtil.builder(data,
......@@ -83,7 +83,7 @@ public class TaskInfoController extends CyPaginationController<TaskInfo> {
@ApiOperation(value="修改?????", notes="修改?????")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable String businessId, @Valid TaskInfo taskInfo, BindingResult bindingResult) {
public CyResult update(@PathVariable Integer businessId, @Valid TaskInfo taskInfo, BindingResult bindingResult) {
taskInfo.setBusinessId(businessId);
CyPersistModel data = taskInfoServiceImpl.merge(taskInfo);
return CyResultGenUtil.builder(data,
......
......@@ -11,20 +11,21 @@ import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableName;
import org.rcisoft.core.entity.CyIdIncreEntity;
/**
* Created with cy on 2024年5月15日 下午6:59:06.
*/
@Data
@TableName("task_info")
public class TaskInfo extends CyIdEntity<TaskInfo> {
public class TaskInfo extends CyIdIncreEntity<TaskInfo> {
/**
* @desc ??id
* @column tack_id
* @default
* @default
*/
@Excel(name = "??id", orderNum = "0", width = 20)
private String tackId;
......@@ -32,7 +33,7 @@ public class TaskInfo extends CyIdEntity<TaskInfo> {
/**
* @desc ?? 0:??? 1:???
* @column status
* @default
* @default
*/
@Excel(name = "?? 0:??? 1:???", orderNum = "1", width = 20)
private String status;
......@@ -40,7 +41,7 @@ public class TaskInfo extends CyIdEntity<TaskInfo> {
/**
* @desc ??
* @column type
* @default
* @default
*/
@Excel(name = "??", orderNum = "2", width = 20)
private String type;
......
......@@ -4,8 +4,8 @@
<resultMap id="BaseResultMap" type="org.rcisoft.bus.taskinfo.entity.TaskInfo">
<id column="business_id" jdbcType="BIGINT" property="businessId"/>
<result column="flag" jdbcType="NCHAR" property="flag"/>
<result column="del_flag" jdbcType="NCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="DATE" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
......@@ -14,6 +14,7 @@
<result column="tack_id" jdbcType="VARCHAR" property="tackId"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
......@@ -25,7 +26,7 @@
and flag = #{entity.flag}
</if>
<if test="entity.tackId !=null and entity.tackId != '' ">
and tack_id like concat('%',#{entity.tackId},'%')
and tack_id = #{entity.tackId}
</if>
<if test="entity.status !=null and entity.status != '' ">
and status like concat('%',#{entity.status},'%')
......@@ -54,4 +55,4 @@
</if>
ORDER BY business_id DESC
</select>
</mapper>
\ No newline at end of file
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment