opt:优化工厂日历创建失败时回滚操作。
This commit is contained in:
@@ -3,25 +3,15 @@ package org.nl.common.utils;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
import org.nl.common.publish.event.PublishEvent;
|
|
||||||
import org.nl.config.thread.ThreadPoolExecutorUtil;
|
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.nl.wms.system_manage.service.ql.IPdmQlOptionService;
|
import org.nl.wms.system_manage.service.ql.IPdmQlOptionService;
|
||||||
import org.nl.wms.system_manage.service.ql.dao.PdmQlOption;
|
import org.nl.wms.system_manage.service.ql.dao.PdmQlOption;
|
||||||
import org.nl.wms.system_manage.service.ql.dto.OptionRecordQuery;
|
import org.nl.wms.system_manage.service.ql.dto.OptionRecordQuery;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import javax.sql.DataSource;
|
|||||||
public class MybatisPlusConfig {
|
public class MybatisPlusConfig {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DataSource dataSource;
|
private DataSource dataSource;
|
||||||
/**
|
/**
|
||||||
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
|
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除)
|
||||||
添加自增插件
|
添加自增插件
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
@@ -33,6 +34,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableAsync
|
||||||
public class AsyncTaskExecutePool implements AsyncConfigurer{
|
public class AsyncTaskExecutePool implements AsyncConfigurer{
|
||||||
/**
|
/**
|
||||||
* 注入配置类
|
* 注入配置类
|
||||||
@@ -81,7 +83,8 @@ public class AsyncTaskExecutePool implements AsyncConfigurer{
|
|||||||
// 活跃时间
|
// 活跃时间
|
||||||
threadPoolTaskExecutor.setKeepAliveSeconds(config.getKeepAliveSeconds());
|
threadPoolTaskExecutor.setKeepAliveSeconds(config.getKeepAliveSeconds());
|
||||||
// 主线程等待子线程执行时间
|
// 主线程等待子线程执行时间
|
||||||
threadPoolTaskExecutor.setAwaitTerminationSeconds(30);
|
threadPoolTaskExecutor.setAwaitTerminationSeconds(config.getAwaitTerminationSeconds());
|
||||||
|
// threadPoolTaskExecutor.setAwaitTerminationSeconds(30);
|
||||||
// 线程名字前缀
|
// 线程名字前缀
|
||||||
threadPoolTaskExecutor.setThreadNamePrefix("test-thread-");
|
threadPoolTaskExecutor.setThreadNamePrefix("test-thread-");
|
||||||
// RejectedExecutionHandler:当pool已经达到max-size的时候,如何处理新任务
|
// RejectedExecutionHandler:当pool已经达到max-size的时候,如何处理新任务
|
||||||
|
|||||||
@@ -38,4 +38,7 @@ public class AsyncTaskProperties {
|
|||||||
private int keepAliveSeconds;
|
private int keepAliveSeconds;
|
||||||
|
|
||||||
private int queueCapacity;
|
private int queueCapacity;
|
||||||
|
|
||||||
|
private int awaitTerminationSeconds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ApsSchedule{
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IMpsSaleOrderService iMpsSaleOrderService;
|
private IMpsSaleOrderService iMpsSaleOrderService;
|
||||||
|
|
||||||
@Async("taskExecutor")
|
//@Async("taskExecutor")
|
||||||
//@Scheduled(cron = "0/30 * * * * *")
|
//@Scheduled(cron = "0/30 * * * * *")
|
||||||
public void setApsStatus() {
|
public void setApsStatus() {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|||||||
Binary file not shown.
@@ -1,7 +1,5 @@
|
|||||||
|
|
||||||
package org.nl.wms.product_manage.备份pdm.service.impl;
|
package org.nl.wms.product_manage.备份pdm.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
@@ -12,14 +10,13 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.WqlUtil;
|
import org.nl.modules.wql.util.WqlUtil;
|
||||||
import org.nl.wms.product_manage.备份pdm.service.FactoryCalendarService;
|
import org.nl.wms.product_manage.备份pdm.service.FactoryCalendarService;
|
||||||
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
@@ -36,244 +33,250 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FactoryCalendarServiceImpl implements FactoryCalendarService {
|
public class FactoryCalendarServiceImpl implements FactoryCalendarService{
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> queryAll(Map whereJson, Pageable page) {
|
||||||
|
String search = MapUtil.getStr(whereJson, "search");
|
||||||
|
HashMap<String,String> map = new HashMap<>();
|
||||||
|
map.put("flag", "1");
|
||||||
|
if(StrUtil.isNotEmpty(search)) {
|
||||||
|
map.put("search", "%" + search + "%");
|
||||||
|
}
|
||||||
|
JSONObject json = WQL.getWO("QPDM_FACTORYCALENDAR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
public JSONArray queryDtl(JSONObject whereJson) {
|
||||||
String search = MapUtil.getStr(whereJson, "search");
|
String year = whereJson.getString("year");
|
||||||
HashMap<String, String> map = new HashMap<>();
|
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
||||||
|
HashMap<String,String> map = new HashMap<>();
|
||||||
|
map.put("flag", "2");
|
||||||
|
if(StrUtil.isNotEmpty(year)) {
|
||||||
|
map.put("date", year + "%");
|
||||||
|
}
|
||||||
|
if(StrUtil.isNotEmpty(factorycalendar_id)) {
|
||||||
|
map.put("id", factorycalendar_id);
|
||||||
|
}
|
||||||
|
return WQL.getWO("QPDM_FACTORYCALENDAR").addParamMap(map).process().getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
map.put("flag", "1");
|
@Override
|
||||||
if (StrUtil.isNotEmpty(search)) map.put("search", "%" + search + "%");
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void create(JSONObject whereJson) {
|
||||||
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
//插入主表
|
||||||
|
String factorycalendar_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||||
|
whereJson.put("factorycalendar_id", factorycalendar_id);
|
||||||
|
whereJson.put("is_active", "0");
|
||||||
|
whereJson.put("create_id", currentUserId);
|
||||||
|
whereJson.put("create_name", nickName);
|
||||||
|
whereJson.put("create_time", DateUtil.now());
|
||||||
|
WQLObject.getWQLObject("PDM_BI_FactoryCalendar").insert(whereJson);
|
||||||
|
//插入明细表
|
||||||
|
this.insertDtlTransactionally(whereJson);
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject json = WQL.getWO("QPDM_FACTORYCALENDAR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
|
@Override
|
||||||
return json;
|
@Transactional(rollbackFor = Exception.class)
|
||||||
}
|
public void update(JSONObject whereJson) {
|
||||||
|
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
||||||
|
//查询旧的终止年份
|
||||||
|
JSONObject old_jo = WQLObject.getWQLObject("PDM_BI_FactoryCalendar").query("factorycalendar_id = '" + factorycalendar_id + "'").uniqueResult(0);
|
||||||
|
int old_year = old_jo.getIntValue("endfactory_year");
|
||||||
|
int new_year = whereJson.getIntValue("endfactory_year");
|
||||||
|
if(old_year >= new_year) {
|
||||||
|
throw new BadRequestException("新的终止年份不能小于等于之前的终止年份!");
|
||||||
|
}
|
||||||
|
String new_start = (old_year + 1) + "-01-01";
|
||||||
|
whereJson.put("factorycale_startdate", new_start);
|
||||||
|
//插入明细表
|
||||||
|
this.insertDtlTransactionally(whereJson);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||||
public JSONArray queryDtl(JSONObject whereJson) {
|
public void insertDtlTransactionally(JSONObject row) {
|
||||||
String year = whereJson.getString("year");
|
insertDtl(row);
|
||||||
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
}
|
||||||
HashMap<String, String> map = new HashMap<>();
|
|
||||||
map.put("flag", "2");
|
|
||||||
if (StrUtil.isNotEmpty(year)) map.put("date", year + "%");
|
|
||||||
if (StrUtil.isNotEmpty(factorycalendar_id)) map.put("id", factorycalendar_id);
|
|
||||||
return WQL.getWO("QPDM_FACTORYCALENDAR").addParamMap(map).process().getResultJSONArray(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Async("taskExecutor")
|
||||||
|
public void insertDtl(JSONObject row) {
|
||||||
@Override
|
try {
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
String a = DateUtil.format(DateUtil.parse(row.getString("factorycale_startdate")), "yyyy/MM/dd");
|
||||||
public void create(JSONObject whereJson) {
|
String b = row.getString("endfactory_year") + "/12/31";
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
while(!a.equals(b)) {
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
JSONObject dtl = new JSONObject();
|
||||||
//插入主表
|
dtl.put("factorycalendardtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||||
String factorycalendar_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
dtl.put("factorycalendar_id", row.getString("factorycalendar_id"));
|
||||||
whereJson.put("factorycalendar_id", factorycalendar_id);
|
dtl.put("factory_date", a);
|
||||||
whereJson.put("is_active", "0");
|
int dayOfWeek = DateUtil.dayOfWeek(DateUtil.parse(a));
|
||||||
whereJson.put("create_id", currentUserId);
|
switch(dayOfWeek) {
|
||||||
whereJson.put("create_name", nickName);
|
case 1:
|
||||||
whereJson.put("create_time", DateUtil.now());
|
if("1".equals(row.getString("is_sun"))) {
|
||||||
WQLObject.getWQLObject("PDM_BI_FactoryCalendar").insert(whereJson);
|
dtl.put("factorydate_type", "01");
|
||||||
|
dtl.put("work_type", "00");
|
||||||
//插入明细表
|
dtl.put("work_type_name", "工作日");
|
||||||
this.insertDtl(whereJson);
|
dtl.put("priority", "50");
|
||||||
|
}
|
||||||
}
|
else{
|
||||||
|
dtl.put("factorydate_type", "03");
|
||||||
@Override
|
dtl.put("work_type", "01");
|
||||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
dtl.put("work_type_name", "休息日");
|
||||||
public void update(JSONObject whereJson) {
|
}
|
||||||
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
break;
|
||||||
|
case 2:
|
||||||
//查询旧的终止年份
|
if("1".equals(row.getString("is_mon"))) {
|
||||||
JSONObject old_jo = WQLObject.getWQLObject("PDM_BI_FactoryCalendar").query("factorycalendar_id = '" + factorycalendar_id + "'").uniqueResult(0);
|
dtl.put("factorydate_type", "01");
|
||||||
|
dtl.put("work_type", "00");
|
||||||
int old_year = old_jo.getIntValue("endfactory_year");
|
dtl.put("work_type_name", "工作日");
|
||||||
int new_year = whereJson.getIntValue("endfactory_year");
|
dtl.put("priority", "50");
|
||||||
|
}
|
||||||
if (old_year >= new_year) {
|
else{
|
||||||
throw new BadRequestException("新的终止年份不能小于等于之前的终止年份!");
|
dtl.put("factorydate_type", "03");
|
||||||
}
|
dtl.put("work_type", "01");
|
||||||
|
dtl.put("work_type_name", "休息日");
|
||||||
String new_start = (old_year + 1) + "-01-01";
|
}
|
||||||
whereJson.put("factorycale_startdate", new_start);
|
break;
|
||||||
//插入明细表
|
case 3:
|
||||||
this.insertDtl(whereJson);
|
if("1".equals(row.getString("is_tue"))) {
|
||||||
}
|
dtl.put("factorydate_type", "01");
|
||||||
|
dtl.put("work_type", "00");
|
||||||
@Async
|
dtl.put("work_type_name", "工作日");
|
||||||
public void insertDtl(JSONObject row) {
|
dtl.put("priority", "50");
|
||||||
|
}
|
||||||
String a =DateUtil.format(DateUtil.parse( row.getString("factorycale_startdate")), "yyyy/MM/dd");
|
else{
|
||||||
String b = row.getString("endfactory_year")+ "/12/31";
|
dtl.put("factorydate_type", "03");
|
||||||
while (!a.equals(b)) {
|
dtl.put("work_type", "01");
|
||||||
JSONObject dtl = new JSONObject();
|
dtl.put("work_type_name", "休息日");
|
||||||
dtl.put("factorycalendardtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
}
|
||||||
dtl.put("factorycalendar_id", row.getString("factorycalendar_id"));
|
break;
|
||||||
dtl.put("factory_date", a);
|
case 4:
|
||||||
int dayOfWeek = DateUtil.dayOfWeek(DateUtil.parse(a));
|
if("1".equals(row.getString("is_wed"))) {
|
||||||
switch (dayOfWeek) {
|
dtl.put("factorydate_type", "01");
|
||||||
case 1:
|
dtl.put("work_type", "00");
|
||||||
if (row.getString("is_sun").equals("1")) {
|
dtl.put("work_type_name", "工作日");
|
||||||
dtl.put("factorydate_type", "01");
|
dtl.put("priority", "50");
|
||||||
dtl.put("work_type", "00");
|
}
|
||||||
dtl.put("work_type_name", "工作日");
|
else{
|
||||||
dtl.put("priority", "50");
|
dtl.put("factorydate_type", "03");
|
||||||
} else {
|
dtl.put("work_type", "01");
|
||||||
dtl.put("factorydate_type", "03");
|
dtl.put("work_type_name", "休息日");
|
||||||
dtl.put("work_type", "01");
|
}
|
||||||
dtl.put("work_type_name", "休息日");
|
break;
|
||||||
|
case 5:
|
||||||
|
if("1".equals(row.getString("is_thu"))) {
|
||||||
|
dtl.put("factorydate_type", "01");
|
||||||
|
dtl.put("work_type", "00");
|
||||||
|
dtl.put("work_type_name", "工作日");
|
||||||
|
dtl.put("priority", "50");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
dtl.put("factorydate_type", "03");
|
||||||
|
dtl.put("work_type", "01");
|
||||||
|
dtl.put("work_type_name", "休息日");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
if("1".equals(row.getString("is_fri"))) {
|
||||||
|
dtl.put("factorydate_type", "01");
|
||||||
|
dtl.put("work_type", "00");
|
||||||
|
dtl.put("work_type_name", "工作日");
|
||||||
|
dtl.put("priority", "50");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
dtl.put("factorydate_type", "03");
|
||||||
|
dtl.put("work_type", "01");
|
||||||
|
dtl.put("work_type_name", "休息日");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
if("1".equals(row.getString("is_sau"))) {
|
||||||
|
dtl.put("factorydate_type", "01");
|
||||||
|
dtl.put("work_type", "00");
|
||||||
|
dtl.put("work_type_name", "工作日");
|
||||||
|
dtl.put("priority", "50");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
dtl.put("factorydate_type", "03");
|
||||||
|
dtl.put("work_type", "01");
|
||||||
|
dtl.put("work_type_name", "休息日");
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
WQLObject.getWQLObject("PDM_BI_FactoryCalendarDtl").insert(dtl);
|
||||||
case 2:
|
a = DateUtil.format(DateUtil.offsetDay(DateUtil.parse(a), 1), "yyyy/MM/dd");
|
||||||
if (row.getString("is_mon").equals("1")) {
|
}
|
||||||
dtl.put("factorydate_type", "01");
|
}
|
||||||
dtl.put("work_type", "00");
|
catch(Exception e) {
|
||||||
dtl.put("work_type_name", "工作日");
|
throw new BadRequestException(HttpStatus.BAD_REQUEST, "操作工厂日历表失败!");
|
||||||
dtl.put("priority", "50");
|
}
|
||||||
} else {
|
}
|
||||||
dtl.put("factorydate_type", "03");
|
|
||||||
dtl.put("work_type", "01");
|
|
||||||
dtl.put("work_type_name", "休息日");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (row.getString("is_tue").equals("1")) {
|
|
||||||
dtl.put("factorydate_type", "01");
|
|
||||||
dtl.put("work_type", "00");
|
|
||||||
dtl.put("work_type_name", "工作日");
|
|
||||||
dtl.put("priority", "50");
|
|
||||||
} else {
|
|
||||||
dtl.put("factorydate_type", "03");
|
|
||||||
dtl.put("work_type", "01");
|
|
||||||
dtl.put("work_type_name", "休息日");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
if (row.getString("is_wed").equals("1")) {
|
|
||||||
dtl.put("factorydate_type", "01");
|
|
||||||
dtl.put("work_type", "00");
|
|
||||||
dtl.put("work_type_name", "工作日");
|
|
||||||
dtl.put("priority", "50");
|
|
||||||
} else {
|
|
||||||
dtl.put("factorydate_type", "03");
|
|
||||||
dtl.put("work_type", "01");
|
|
||||||
dtl.put("work_type_name", "休息日");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
if (row.getString("is_thu").equals("1")) {
|
|
||||||
dtl.put("factorydate_type", "01");
|
|
||||||
dtl.put("work_type", "00");
|
|
||||||
dtl.put("work_type_name", "工作日");
|
|
||||||
dtl.put("priority", "50");
|
|
||||||
} else {
|
|
||||||
dtl.put("factorydate_type", "03");
|
|
||||||
dtl.put("work_type", "01");
|
|
||||||
dtl.put("work_type_name", "休息日");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
if (row.getString("is_fri").equals("1")) {
|
|
||||||
dtl.put("factorydate_type", "01");
|
|
||||||
dtl.put("work_type", "00");
|
|
||||||
dtl.put("work_type_name", "工作日");
|
|
||||||
dtl.put("priority", "50");
|
|
||||||
} else {
|
|
||||||
dtl.put("factorydate_type", "03");
|
|
||||||
dtl.put("work_type", "01");
|
|
||||||
dtl.put("work_type_name", "休息日");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
if (row.getString("is_sau").equals("1")) {
|
|
||||||
dtl.put("factorydate_type", "01");
|
|
||||||
dtl.put("work_type", "00");
|
|
||||||
dtl.put("work_type_name", "工作日");
|
|
||||||
dtl.put("priority", "50");
|
|
||||||
} else {
|
|
||||||
dtl.put("factorydate_type", "03");
|
|
||||||
dtl.put("work_type", "01");
|
|
||||||
dtl.put("work_type_name", "休息日");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
WQLObject.getWQLObject("PDM_BI_FactoryCalendarDtl").insert(dtl);
|
|
||||||
a = DateUtil.format(DateUtil.offsetDay(DateUtil.parse(a), 1), "yyyy/MM/dd");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAll(Long[] ids) {
|
public void deleteAll(Long[] ids) {
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("pdm_bi_factorycalendar");
|
||||||
|
for(Long factorycalendar_id : ids) {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("factorycalendar_id", String.valueOf(factorycalendar_id));
|
||||||
|
param.put("is_delete", "1");
|
||||||
|
param.put("update_optid", currentUserId);
|
||||||
|
param.put("update_optname", nickName);
|
||||||
|
param.put("update_time", DateUtil.now());
|
||||||
|
wo.update(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getDtl(JSONObject whereJson) {
|
||||||
|
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
||||||
|
String date = whereJson.getString("date");
|
||||||
|
JSONObject jo = WQLObject.getWQLObject("PDM_BI_FactoryCalendarDtl").query("factorycalendar_id = '" + factorycalendar_id + "' AND factory_date ='" + date + "'").uniqueResult(0);
|
||||||
|
return jo;
|
||||||
|
}
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_factorycalendar");
|
@Override
|
||||||
for (Long factorycalendar_id : ids) {
|
public void updateActive(JSONObject whereJson) {
|
||||||
JSONObject param = new JSONObject();
|
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
||||||
param.put("factorycalendar_id", String.valueOf(factorycalendar_id));
|
String is_active = whereJson.getString("is_active");
|
||||||
param.put("is_delete", "1");
|
HashMap<String,String> map = new HashMap<>();
|
||||||
param.put("update_optid", currentUserId);
|
map.put("is_active", is_active);
|
||||||
param.put("update_optname", nickName);
|
WQLObject.getWQLObject("PDM_BI_FactoryCalendar").update(map, "factorycalendar_id = '" + factorycalendar_id + "'");
|
||||||
param.put("update_time", DateUtil.now());
|
}
|
||||||
wo.update(param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getDtl(JSONObject whereJson) {
|
public void updateDtlStatus(JSONObject whereJson) {
|
||||||
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
String holidayType = whereJson.getString("holidayType");
|
||||||
String date = whereJson.getString("date");
|
String holidayDate = DateUtil.format(DateUtil.parse(whereJson.getString("holidayDate")), "yyyy/MM/dd");
|
||||||
JSONObject jo = WQLObject.getWQLObject("PDM_BI_FactoryCalendarDtl").query("factorycalendar_id = '" + factorycalendar_id + "' AND factory_date ='" + date + "'").uniqueResult(0);
|
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
||||||
return jo;
|
HashMap<String,String> map = new HashMap<>();
|
||||||
}
|
map.put("work_type", holidayType);
|
||||||
|
if(holidayType.equals("00")) {
|
||||||
@Override
|
map.put("factorydate_type", "01");
|
||||||
public void updateActive(JSONObject whereJson) {
|
map.put("priority", "50");
|
||||||
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
map.put("work_type_name", "工作日");
|
||||||
String is_active = whereJson.getString("is_active");
|
}
|
||||||
HashMap<String, String> map = new HashMap<>();
|
else{
|
||||||
map.put("is_active", is_active);
|
map.put("factorydate_type", "03");
|
||||||
WQLObject.getWQLObject("PDM_BI_FactoryCalendar").update(map, "factorycalendar_id = '" + factorycalendar_id + "'");
|
map.put("priority", "100");
|
||||||
}
|
map.put("work_type_name", "休息日");
|
||||||
|
}
|
||||||
|
WQLObject.getWQLObject("PDM_BI_FactoryCalendarDtl").update(map, "factorycalendar_id = '" + factorycalendar_id + "' AND factory_date = '" + holidayDate + "'");
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public void updateDtlStatus(JSONObject whereJson) {
|
|
||||||
|
|
||||||
|
|
||||||
String holidayType =whereJson.getString("holidayType");
|
|
||||||
String holidayDate =DateUtil.format(DateUtil.parse( whereJson.getString("holidayDate")), "yyyy/MM/dd");
|
|
||||||
String factorycalendar_id = whereJson.getString("factorycalendar_id");
|
|
||||||
HashMap<String, String> map = new HashMap<>();
|
|
||||||
map.put("work_type", holidayType);
|
|
||||||
if (holidayType.equals("00")) {
|
|
||||||
map.put("factorydate_type", "01");
|
|
||||||
map.put("priority", "50");
|
|
||||||
map.put("work_type_name", "工作日");
|
|
||||||
} else {
|
|
||||||
map.put("factorydate_type", "03");
|
|
||||||
map.put("priority", "100");
|
|
||||||
map.put("work_type_name", "休息日");
|
|
||||||
}
|
|
||||||
WQLObject.getWQLObject("PDM_BI_FactoryCalendarDtl").update(map, "factorycalendar_id = '" + factorycalendar_id + "' AND factory_date = '" + holidayDate + "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateDtlActive(JSONObject whereJson) {
|
|
||||||
String is_active = whereJson.getString("is_active");
|
|
||||||
if (is_active.equals("1")){
|
|
||||||
//查询是否存在已经启用的日历
|
|
||||||
JSONObject mst = WQLObject.getWQLObject("PDM_BI_FactoryCalendar").query("is_active = '1' AND is_delete = '0'").uniqueResult(0);
|
|
||||||
if (ObjectUtil.isNotEmpty(mst)){
|
|
||||||
throw new BadRequestException("工厂日历只能启用一个!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WQLObject.getWQLObject("PDM_BI_FactoryCalendar").update(whereJson);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDtlActive(JSONObject whereJson) {
|
||||||
|
String is_active = whereJson.getString("is_active");
|
||||||
|
if(is_active.equals("1")) {
|
||||||
|
//查询是否存在已经启用的日历
|
||||||
|
JSONObject mst = WQLObject.getWQLObject("PDM_BI_FactoryCalendar").query("is_active = '1' AND is_delete = '0'").uniqueResult(0);
|
||||||
|
if(ObjectUtil.isNotEmpty(mst)) {
|
||||||
|
throw new BadRequestException("工厂日历只能启用一个!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WQLObject.getWQLObject("PDM_BI_FactoryCalendar").update(whereJson);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -28,6 +28,8 @@ task:
|
|||||||
keep-alive-seconds: 60
|
keep-alive-seconds: 60
|
||||||
# 队列容量
|
# 队列容量
|
||||||
queue-capacity: 50
|
queue-capacity: 50
|
||||||
|
# 主线程等待子线程执行时间
|
||||||
|
awaitTerminationSeconds: 50
|
||||||
|
|
||||||
#七牛云
|
#七牛云
|
||||||
qiniu:
|
qiniu:
|
||||||
|
|||||||
Reference in New Issue
Block a user