Commit db9437cb authored by 高宇's avatar 高宇

1.修改月度拉取

parent e5c229fc
package org.rcisoft.bus.bcustomer.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
......@@ -31,6 +32,12 @@ public class BCustomer extends CyIdIncreEntity<BCustomer> {
@Excel(name = "custCode", orderNum = "0", width = 20)
private String custCode;
/**
* 月度查询 cc
* **/
@TableField(exist = false)
private String cc;
/**
* @desc
* @column cust_name
......
package org.rcisoft.bus.bpnsypn.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
......@@ -39,6 +40,12 @@ public class BPnSypn extends CyIdIncreEntity<BPnSypn> {
@Excel(name = "sypn", orderNum = "1", width = 20)
private String sypn;
/**
* 月度信息pn查询
* **/
@TableField(exist = false)
private String copyPn;
}
......@@ -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.jnsp7xtmdqsj.dto.Jnsp7xtmDqsjPageHandleDto;
import org.rcisoft.bus.taskinfo.entity.TaskInfo;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
......@@ -145,7 +146,7 @@ public class Jnsp7xtmDqsjController extends CyPaginationController<Jnsp7xtmDqsj>
@CyOpeLogAnno(title = "system-Jnsp7xtmDqsj管理-数据表重置", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value = "数据表重置", notes = "数据表重置")
@GetMapping(value = "/dataTableRese")
public CyResult truncateTable(String key) {
public CyResult truncateTable() {
return CyResultGenUtil.builder(jnsp7xtmDqsjServiceImpl.dataTableRese(),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
......@@ -165,4 +166,25 @@ public class Jnsp7xtmDqsjController extends CyPaginationController<Jnsp7xtmDqsj>
CyMessCons.MESSAGE_ALERT_ERROR,
taskInfo);
}
@CyOpeLogAnno(title = "system-Jnsp7xtmDqsj管理-月度表重置", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value = "月度表重置", notes = "月度表重置")
@GetMapping(value = "/monthlyReset")
public CyResult monthlyReset(Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto) {
return CyResultGenUtil.builder(jnsp7xtmDqsjServiceImpl.monthlyReset(jnsp7xtmDqsjPageHandleDto),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
null);
}
@CyOpeLogAnno(title = "system-Jnsp7xtmDqsj管理-客户表重置", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value = "客户表重置", notes = "客户表重置")
@GetMapping(value = "/clientReset")
public CyResult clientReset(Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto) {
return CyResultGenUtil.builder(jnsp7xtmDqsjServiceImpl.clientReset(jnsp7xtmDqsjPageHandleDto),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
null);
}
}
......@@ -55,5 +55,10 @@ public interface Jnsp7xtmDqsjRepository extends CyBaseMapper<Jnsp7xtmDqsj> {
* **/
Integer queryTotalJnsp7xtmDqs();
/**
* 删除Jnsp7xtmDqs
* **/
int deleteJnsp7xtmDqs(@Param("entity") Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto);
}
......@@ -25,5 +25,25 @@ public class Jnsp7xtmDqsjPageHandleDto {
// 页长度
private Integer rows;
// 类型 1:月度表重置 2.客户表重置
private String type;
// term
private String term;
// month
private String month;
// cc
private String cc;
// cn
private String cn;
// sypn
private String sypn;
}
......@@ -23,12 +23,7 @@ import java.util.List;
*/
@Data
@TableName("jnsp7xtm_dqsj")
public class Jnsp7xtmDqsj {
@TableId(value = "business_id", type = IdType.AUTO)
@TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.INTEGER)
@ApiModelProperty(name = "businessId", value = "businessId", required = true, dataType = "integer")
private Integer businessId;
public class Jnsp7xtmDqsj extends CyIdIncreEntity {
/**
* @desc
......@@ -398,7 +393,8 @@ public class Jnsp7xtmDqsj {
if (StringUtils.isNotBlank(jnsp7xtmVo.getXslj())) {
if (jnsp7xtmVo.getXslj().equals("W0"))
jnsp7xtmDqsj.setIo("I");
jnsp7xtmDqsj.setIo("O");
else
jnsp7xtmDqsj.setIo("O");
}
jnsp7xtmDqsj.setRoute(jnsp7xtmVo.getXslj());
jnsp7xtmDqsj.setPc(jnsp7xtmVo.getZd());
......@@ -406,7 +402,8 @@ public class Jnsp7xtmDqsj {
if (StringUtils.isNotBlank(jnsp7xtmVo.getZd())) {
if (jnsp7xtmVo.getZd().equals("CR") || jnsp7xtmVo.getZd().equals("WR") || jnsp7xtmVo.getZd().equals("MP"))
jnsp7xtmDqsj.setFactory("CC1");
jnsp7xtmDqsj.setFactory("CC2");
else
jnsp7xtmDqsj.setFactory("CC2");
}
jnsp7xtmDqsj.setSize(jnsp7xtmVo.getJlpm());
jnsp7xtmDqsj.setPn(jnsp7xtmVo.getPn());
......
......@@ -3,6 +3,7 @@ package org.rcisoft.bus.jnsp7xtmdqsj.service;
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.dto.Jnsp7xtmDqsjPageHandleDto;
import org.rcisoft.bus.jnsp7xtmdqsj.entity.Jnsp7xtmDqsj;
import org.rcisoft.bus.taskinfo.entity.TaskInfo;
import org.rcisoft.core.model.CyPersistModel;
......@@ -85,4 +86,14 @@ public interface Jnsp7xtmDqsjService {
// 添加任务
TaskInfo addTaskInfo();
/**
* 月度表重置
* **/
CyPersistModel monthlyReset(Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto);
/**
* 客户表重置
* **/
CyPersistModel clientReset(Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto);
}
......@@ -66,11 +66,11 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,Jnsp7xtmDqsj> implements Jnsp7xtmDqsjService {
// 数据表重置
private static Lock dataTableResetLock = new ReentrantLock();
// 前四个按钮的
private static Lock topFourButtonLock = new ReentrantLock();
// 月度表拉取锁
private static Lock monthlyTablePullLock = new ReentrantLock();
//
private static Lock finallyButtonLockLock = new ReentrantLock();
@Autowired
private TaskInfoRepository taskInfoRepository;
......@@ -107,7 +107,8 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(Jnsp7xtmDqsj jnsp7xtmDqsj){
int line = baseMapper.realDelete(jnsp7xtmDqsj);
jnsp7xtmDqsj.setDeleted();
int line = baseMapper.deleteById(jnsp7xtmDqsj);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+
jnsp7xtmDqsj.getBusinessId()+"的信息");
return new CyPersistModel(line);
......@@ -182,13 +183,13 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
@Override
public CyPersistModel dataTableRese() {
try {
if (dataTableResetLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
if (topFourButtonLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
try {
baseMapper.truncateJnsp7xtmDqsj(shema);
} catch (Exception e) {
e.printStackTrace();
} finally {
dataTableResetLock.unlock();
topFourButtonLock.unlock();
}
} else {
throw new CyServiceException(501,"该功能使用频繁,请稍后重试");
......@@ -208,7 +209,7 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
public CyPersistModel monthlyTablePull(String taskId) {
try {
if (monthlyTablePullLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
if (topFourButtonLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
try {
// 创建并启动计时器
Stopwatch stopwatch = Stopwatch.createStarted();
......@@ -222,6 +223,7 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto = Jnsp7xtmDqsjPageHandleDto.builder().page(i).rows(pageQuerySize).build();
addJnsp7xtmDqsjByPage(jnsp7xtmDqsjPageHandleDto);
}
// Thread.sleep(5000);
LambdaUpdateWrapper<TaskInfo> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TaskInfo::getTackId,taskId).set(TaskInfo::getStatus,"1");
taskInfoRepository.update(null,updateWrapper);
......@@ -231,7 +233,7 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
throw new CyServiceException(501,"数据同步异常");
}
finally {
monthlyTablePullLock.unlock();
topFourButtonLock.unlock();
}
} else {
throw new CyServiceException(501,"该功能使用频繁,请稍后重试");
......@@ -248,6 +250,10 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
baseMapper.streamQuery(resultContext -> {
Jnsp7xtmVo resultObject = resultContext.getResultObject();
Jnsp7xtmDqsj jnsp7xtmDqsj = Jnsp7xtmDqsj.generateJnsp7xtmDqsj(resultObject);
jnsp7xtmDqsj.setFlag("1");
jnsp7xtmDqsj.setCreateDate(new Date());
jnsp7xtmDqsj.setUpdateDate(new Date());
jnsp7xtmDqsj.setDelFlag("0");
addList.add(jnsp7xtmDqsj);
if (addList.size() > batchInsertSize) {
log.info("addList",addList);
......@@ -264,7 +270,7 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
public TaskInfo addTaskInfo() {
TaskInfo taskInfo = new TaskInfo();
try {
if (monthlyTablePullLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
if (topFourButtonLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
try {
taskInfo.setStatus("0");
taskInfo.setTackId(CyIdGenUtil.uuid());
......@@ -275,7 +281,7 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
e.printStackTrace();
throw new CyServiceException(501,"数据同步异常");
} finally {
monthlyTablePullLock.unlock();
topFourButtonLock.unlock();
}
} else {
throw new CyServiceException(501,"该功能使用频繁,请稍后重试");
......@@ -286,4 +292,60 @@ public class Jnsp7xtmDqsjServiceImpl extends ServiceImpl<Jnsp7xtmDqsjRepository,
return taskInfo;
}
/**
* 月度表重置
* **/
@Override
public CyPersistModel monthlyReset(Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto) {
try {
if (topFourButtonLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
try {
Jnsp7xtmDqsjPageHandleDto requestCondition = this.acquireRequestCondition(jnsp7xtmDqsjPageHandleDto);
requestCondition.setType("1");
int i = baseMapper.deleteJnsp7xtmDqs(requestCondition);
} catch (Exception e) {
e.printStackTrace();
} finally {
topFourButtonLock.unlock();
}
} else {
throw new CyServiceException(501,"该功能使用频繁,请稍后重试");
}
} catch (InterruptedException e) {
e.printStackTrace();
}
return new CyPersistModel(1);
}
/**
* 客户表重置
***/
@Override
public CyPersistModel clientReset(Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto) {
try {
if (topFourButtonLock.tryLock(1000, TimeUnit.MILLISECONDS)) {
try {
Jnsp7xtmDqsjPageHandleDto requestCondition = this.acquireRequestCondition(jnsp7xtmDqsjPageHandleDto);
requestCondition.setType("2");
int i = baseMapper.deleteJnsp7xtmDqs(requestCondition);
} catch (Exception e) {
e.printStackTrace();
} finally {
topFourButtonLock.unlock();
}
} else {
throw new CyServiceException(501,"该功能使用频繁,请稍后重试");
}
} catch (InterruptedException e) {
e.printStackTrace();
}
return new CyPersistModel(1);
}
private Jnsp7xtmDqsjPageHandleDto acquireRequestCondition(Jnsp7xtmDqsjPageHandleDto jnsp7xtmDqsjPageHandleDto) {
Jnsp7xtmDqsjPageHandleDto requestJnsp7xtmDqs = new Jnsp7xtmDqsjPageHandleDto();
BeanUtil.copyProperties(jnsp7xtmDqsjPageHandleDto,requestJnsp7xtmDqs);
return requestJnsp7xtmDqs;
}
}
......@@ -46,6 +46,9 @@
<if test="entity.custCode != null and entity.custCode != ''">
and cust_code like concat('%',#{entity.custCode},'%')
</if>
<if test="entity.cc != null and entity.cc != ''">
and cust_code = #{entity.cc}
</if>
<if test="entity.custName != null and entity.custName != ''">
and cust_name like concat('%',#{entity.custName },'%')
</if>
......
......@@ -26,6 +26,9 @@
<if test="entity.pn !=null and entity.pn != '' ">
and pn like concat('%',#{entity.pn},'%')
</if>
<if test="entity.copyPn!=null and entity.copyPn != '' ">
and pn = #{entity.copyPn}
</if>
<if test="entity.sypn !=null and entity.sypn != '' ">
and sypn like concat('%',#{entity.sypn},'%')
</if>
......
......@@ -43,6 +43,13 @@
<result column="cust_yj3" jdbcType="VARCHAR" property="custYj3"/>
<result column="cust_gc" jdbcType="VARCHAR" property="custGc"/>
<result column="sypn" jdbcType="VARCHAR" property="sypn"/>
<result column="flag" jdbcType="NCHAR" property="flag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
</resultMap>
<resultMap id="Jnsp7xtmVoResultMap" type="org.rcisoft.bus.jnsp7xtm.vo.Jnsp7xtmVo">
......@@ -99,9 +106,9 @@
<insert id="batchAddJnsp7xtmDqsj" parameterType="java.util.List">
INSERT into jnsp7xtm_dqsj(term,half,quarter,month,cc,cn,io,route,pc,factory,size,pn,po,fc,qty,up,currency,rate,amt,cust_group,cust_group2,cust_rt1,cust_io,cust_newpic,cust_group1,cust_rt2,cust_rout,cust_addr,cust_g0,cust_g20,cust_g30,cust_g201,cust_save,cust_stype,cust_g1,cust_yj,cust_yj2,cust_yj3,cust_gc,sypn) values
INSERT into jnsp7xtm_dqsj(term,half,quarter,month,cc,cn,io,route,pc,factory,size,pn,po,fc,qty,up,currency,rate,amt,cust_group,cust_group2,cust_rt1,cust_io,cust_newpic,cust_group1,cust_rt2,cust_rout,cust_addr,cust_g0,cust_g20,cust_g30,cust_g201,cust_save,cust_stype,cust_g1,cust_yj,cust_yj2,cust_yj3,cust_gc,sypn,flag,,create_date,update_date,remarks,del_flag) values
<foreach collection="list" item="item" separator=",">
(#{item.term}, #{item.half},#{item.quarter},#{item.month},#{item.cc},#{item.cn},#{item.io},#{item.route},#{item.pc},#{item.factory},#{item.size},#{item.pn},#{item.po},#{item.fc},#{item.qty},#{item.up},#{item.currency},#{item.rate},#{item.amt},#{item.custGroup},#{item.custGroup2},#{item.custRt1},#{item.custIo},#{item.custNewpic},#{item.custGroup1},#{item.custRt2},#{item.custRout},#{item.custAddr},#{item.custG0},#{item.custG20},#{item.custG30},#{item.custG201},#{item.custSave},#{item.custStype},#{item.custG1},#{item.custYj},#{item.custYj2},#{item.custYj3},#{item.custGc},#{item.sypn})
(#{item.term}, #{item.half},#{item.quarter},#{item.month},#{item.cc},#{item.cn},#{item.io},#{item.route},#{item.pc},#{item.factory},#{item.size},#{item.pn},#{item.po},#{item.fc},#{item.qty},#{item.up},#{item.currency},#{item.rate},#{item.amt},#{item.custGroup},#{item.custGroup2},#{item.custRt1},#{item.custIo},#{item.custNewpic},#{item.custGroup1,#{item.custRt2},#{item.custRout},#{item.custAddr},#{item.custG0},#{item.custG20},#{item.custG30},#{item.custG201},#{item.custSave},#{item.custStype},#{item.custG1},#{item.custYj},#{item.custYj2},#{item.custYj3},#{item.custGc},#{item.sypn},#{item.flag},#{item.createDate},#{item.updateDate},#{item.remarks},#{item.delFlag})
</foreach>
</insert>
......@@ -109,7 +116,7 @@
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryJnsp7xtmDqsjs" resultMap="BaseResultMap">
select * from jnsp7xtm_dqsj
where 1=1
where del_flag = '0'
<if test="entity.term !=null and entity.term != '' ">
and term = #{entity.term}
</if>
......@@ -235,7 +242,8 @@
<select id="queryJnsp7xtmDqsjsPaged" resultMap="BaseResultMap">
select * from jnsp7xtm_dqsj
where 1=1
where
del_flag = '0'
<if test="entity.term !=null and entity.term != '' ">
and term like concat('%',#{entity.term},'%')
</if>
......@@ -362,6 +370,30 @@
<delete id="truncateJnsp7xtmDqsj">
TRUNCATE TABLE ${shema}.jnsp7xtm_dqsj
</delete>
<delete id="deleteJnsp7xtmDqs">
DELETE
FROM
jnsp7xtm_dqsj
where
<if test='entity.type == "1"'>
term = 'C'
</if>
<if test='entity.type == "2"'>
term = 'L'
</if>
<if test="entity.month != '' and entity.month != null">
and month = #{entity.month}
</if>
<if test="entity.cc != '' and entity.cc != null">
and cc = #{entity.cc}
</if>
<if test="entity.cn != '' and entity.cn!= null">
and cn = #{entity.cn}
</if>
<if test="entity.sypn != '' and entity.sypn != null">
and sypn = #{entity.sypn}
</if>
</delete>
<select id="getMonthList" resultType="java.lang.String">
SELECT
DISTINCT month
......
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