feat():问题修复

master
jiyufei 2 months ago
parent acc6e3f7ff
commit b85c4ec20d

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
* JNPF * JNPF
* 2024-08-06 * 2024-08-19
*/ */
public interface YysDayPackageMapper extends BaseMapper<YysDayPackageEntity> { public interface YysDayPackageMapper extends BaseMapper<YysDayPackageEntity> {

@ -15,12 +15,12 @@ import jnpf.model.yysdaywork.ConfirmResponse;
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
* JNPF * JNPF
* 2024-08-06 * 2024-08-19
*/ */
public interface YysDayPackageService extends IService<YysDayPackageEntity> { public interface YysDayPackageService extends IService<YysDayPackageEntity> {
List<YysDayPackageEntity> getList(YysDayPackagePagination yysDayPackagePagination); List<YysDayPackageEntity> getList(YysDayPackagePagination yysDayPackagePagination);
List<YysDayPackageEntity> getTypeList(YysDayPackagePagination yysDayPackagePagination, String dataType); List<YysDayPackageEntity> getTypeList(YysDayPackagePagination yysDayPackagePagination,String dataType);
YysDayPackageEntity getInfo(String id); YysDayPackageEntity getInfo(String id);
@ -32,9 +32,9 @@ public interface YysDayPackageService extends IService<YysDayPackageEntity> {
//子表方法 //子表方法
//副表数据方法 //副表数据方法
String checkForm(YysDayPackageForm form, int i); String checkForm(YysDayPackageForm form,int i);
void saveOrUpdate(YysDayPackageForm yysDayPackageForm, String id, boolean isSave) throws Exception; void saveOrUpdate(YysDayPackageForm yysDayPackageForm,String id, boolean isSave) throws Exception;
/** /**
* -app * -app

@ -39,25 +39,21 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import jnpf.util.*; import jnpf.util.*;
import java.util.*; import java.util.*;
import jnpf.base.UserInfo; import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity; import jnpf.permission.entity.UserEntity;
/** /**
*
* yysDayPackage * yysDayPackage
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
* JNPF * JNPF
* 2024-08-06 * 2024-08-19
*/ */
@Service @Service
public class YysDayPackageServiceImpl extends ServiceImpl<YysDayPackageMapper, YysDayPackageEntity> implements YysDayPackageService { public class YysDayPackageServiceImpl extends ServiceImpl<YysDayPackageMapper, YysDayPackageEntity> implements YysDayPackageService{
@Autowired @Autowired
private GeneraterSwapUtil generaterSwapUtil; private GeneraterSwapUtil generaterSwapUtil;
@ -71,172 +67,169 @@ public class YysDayPackageServiceImpl extends ServiceImpl<YysDayPackageMapper, Y
private YysPackageReportService yysPackageReportService; private YysPackageReportService yysPackageReportService;
@Override @Override
public List<YysDayPackageEntity> getList(YysDayPackagePagination yysDayPackagePagination) { public List<YysDayPackageEntity> getList(YysDayPackagePagination yysDayPackagePagination){
return getTypeList(yysDayPackagePagination, yysDayPackagePagination.getDataType()); return getTypeList(yysDayPackagePagination,yysDayPackagePagination.getDataType());
} }
/** 列表查询 */
/**
*
*/
@Override @Override
public List<YysDayPackageEntity> getTypeList(YysDayPackagePagination yysDayPackagePagination, String dataType) { public List<YysDayPackageEntity> getTypeList(YysDayPackagePagination yysDayPackagePagination,String dataType){
String userId = userProvider.get().getUserId(); String userId=userProvider.get().getUserId();
List<String> AllIdList = new ArrayList(); List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList = new ArrayList<>(); List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? YysDayPackageConstant.getAppColumnData() : YysDayPackageConstant.getColumnData(); String columnData = !isPc ? YysDayPackageConstant.getAppColumnData() : YysDayPackageConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class); ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList()); String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0; int total=0;
int yysDayPackageNum = 0; int yysDayPackageNum =0;
QueryWrapper<YysDayPackageEntity> yysDayPackageQueryWrapper = new QueryWrapper<>(); QueryWrapper<YysDayPackageEntity> yysDayPackageQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>(); List<String> allSuperIDlist = new ArrayList<>();
String superOp = ""; String superOp ="";
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getSuperQueryJson())) { if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>(); List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>(); List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = yysDayPackagePagination.getSuperQueryJson(); String queryJson = yysDayPackagePagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class); SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0; int superNum = 0;
QueryWrapper<YysDayPackageEntity> yysDayPackageSuperWrapper = new QueryWrapper<>(); QueryWrapper<YysDayPackageEntity> yysDayPackageSuperWrapper = new QueryWrapper<>();
yysDayPackageSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysDayPackageSuperWrapper, YysDayPackageEntity.class, queryJson, "0")); yysDayPackageSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysDayPackageSuperWrapper,YysDayPackageEntity.class,queryJson,"0"));
int yysDayPackageNum1 = yysDayPackageSuperWrapper.getExpression().getNormal().size(); int yysDayPackageNum1 = yysDayPackageSuperWrapper.getExpression().getNormal().size();
if (yysDayPackageNum1 > 0) { if (yysDayPackageNum1>0){
List<String> yysDayPackageList = this.list(yysDayPackageSuperWrapper).stream().map(YysDayPackageEntity::getId).collect(Collectors.toList()); List<String> yysDayPackageList =this.list(yysDayPackageSuperWrapper).stream().map(YysDayPackageEntity::getId).collect(Collectors.toList());
allSuperList.addAll(yysDayPackageList); allSuperList.addAll(yysDayPackageList);
intersectionSuperList.add(yysDayPackageList); intersectionSuperList.add(yysDayPackageList);
superNum++; superNum++;
} }
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : ""; superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or //and or
if (superOp.equalsIgnoreCase("and")) { if(superOp.equalsIgnoreCase("and")){
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList); allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
} else { }else{
allSuperIDlist = allSuperList; allSuperIDlist = allSuperList;
} }
} }
List<String> allRuleIDlist = new ArrayList<>(); List<String> allRuleIDlist = new ArrayList<>();
String ruleOp = ""; String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)) { if (ObjectUtil.isNotEmpty(ruleJson)){
List<String> allRuleList = new ArrayList<>(); List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>(); List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class); SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0; int ruleNum = 0;
QueryWrapper<YysDayPackageEntity> yysDayPackageSuperWrapper = new QueryWrapper<>(); QueryWrapper<YysDayPackageEntity> yysDayPackageSuperWrapper = new QueryWrapper<>();
yysDayPackageSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysDayPackageSuperWrapper, YysDayPackageEntity.class, ruleJson, "0")); yysDayPackageSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysDayPackageSuperWrapper,YysDayPackageEntity.class,ruleJson,"0"));
int yysDayPackageNum1 = yysDayPackageSuperWrapper.getExpression().getNormal().size(); int yysDayPackageNum1 = yysDayPackageSuperWrapper.getExpression().getNormal().size();
if (yysDayPackageNum1 > 0) { if (yysDayPackageNum1>0){
List<String> yysDayPackageList = this.list(yysDayPackageSuperWrapper).stream().map(YysDayPackageEntity::getId).collect(Collectors.toList()); List<String> yysDayPackageList =this.list(yysDayPackageSuperWrapper).stream().map(YysDayPackageEntity::getId).collect(Collectors.toList());
allRuleList.addAll(yysDayPackageList); allRuleList.addAll(yysDayPackageList);
intersectionRuleList.add(yysDayPackageList); intersectionRuleList.add(yysDayPackageList);
ruleNum++; ruleNum++;
} }
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : ""; ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or //and or
if (ruleOp.equalsIgnoreCase("and")) { if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList); allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
} else { }else{
allRuleIDlist = allRuleList; allRuleIDlist = allRuleList;
} }
} }
boolean pcPermission = false; boolean pcPermission = false;
boolean appPermission = false; boolean appPermission = false;
if (isPc && pcPermission) { if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()) { if (!userProvider.get().getIsAdministrator()){
Object yysDayPackageObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysDayPackageQueryWrapper, YysDayPackageEntity.class, yysDayPackagePagination.getMenuId(), "0")); Object yysDayPackageObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysDayPackageQueryWrapper,YysDayPackageEntity.class,yysDayPackagePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(yysDayPackageObj)) { if (ObjectUtil.isEmpty(yysDayPackageObj)){
return new ArrayList<>(); return new ArrayList<>();
} else { } else {
yysDayPackageQueryWrapper = (QueryWrapper<YysDayPackageEntity>) yysDayPackageObj; yysDayPackageQueryWrapper = (QueryWrapper<YysDayPackageEntity>)yysDayPackageObj;
if (yysDayPackageQueryWrapper.getExpression().getNormal().size() > 0) { if( yysDayPackageQueryWrapper.getExpression().getNormal().size()>0){
yysDayPackageNum++; yysDayPackageNum++;
} }
} }
} }
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object yysDayPackageObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysDayPackageQueryWrapper,YysDayPackageEntity.class,yysDayPackagePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(yysDayPackageObj)){
return new ArrayList<>();
} else {
yysDayPackageQueryWrapper = (QueryWrapper<YysDayPackageEntity>)yysDayPackageObj;
if( yysDayPackageQueryWrapper.getExpression().getNormal().size()>0){
yysDayPackageNum++;
}
} }
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object yysDayPackageObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysDayPackageQueryWrapper, YysDayPackageEntity.class, yysDayPackagePagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(yysDayPackageObj)) {
return new ArrayList<>();
} else {
yysDayPackageQueryWrapper = (QueryWrapper<YysDayPackageEntity>) yysDayPackageObj;
if (yysDayPackageQueryWrapper.getExpression().getNormal().size() > 0) {
yysDayPackageNum++;
}
}
} }
} }
if (isPc) { if(isPc){
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getManufactureTime())) { if(ObjectUtil.isNotEmpty(yysDayPackagePagination.getManufactureTime())){
yysDayPackageNum++; yysDayPackageNum++;
List ManufactureTimeList = JsonUtil.getJsonToList(yysDayPackagePagination.getManufactureTime(), String.class); List ManufactureTimeList = JsonUtil.getJsonToList(yysDayPackagePagination.getManufactureTime(),String.class);
Long fir = Long.valueOf(String.valueOf(ManufactureTimeList.get(0))); Long fir = Long.valueOf(String.valueOf(ManufactureTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(ManufactureTimeList.get(1))); Long sec = Long.valueOf(String.valueOf(ManufactureTimeList.get(1)));
yysDayPackageQueryWrapper.lambda().ge(YysDayPackageEntity::getManufactureTime, new Date(fir)) yysDayPackageQueryWrapper.lambda().ge(YysDayPackageEntity::getManufactureTime, new Date(fir))
.le(YysDayPackageEntity::getManufactureTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59")); .le(YysDayPackageEntity::getManufactureTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
} }
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getProductCode())) { if(ObjectUtil.isNotEmpty(yysDayPackagePagination.getProductCode())){
yysDayPackageNum++; yysDayPackageNum++;
String value = yysDayPackagePagination.getProductCode() instanceof List ? String value = yysDayPackagePagination.getProductCode() instanceof List ?
JsonUtil.getObjectToString(yysDayPackagePagination.getProductCode()) : JsonUtil.getObjectToString(yysDayPackagePagination.getProductCode()) :
String.valueOf(yysDayPackagePagination.getProductCode()); String.valueOf(yysDayPackagePagination.getProductCode());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getProductCode, value); yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getProductCode,value);
} }
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getProductName())) { if(ObjectUtil.isNotEmpty(yysDayPackagePagination.getProductName())){
yysDayPackageNum++; yysDayPackageNum++;
String value = yysDayPackagePagination.getProductName() instanceof List ? String value = yysDayPackagePagination.getProductName() instanceof List ?
JsonUtil.getObjectToString(yysDayPackagePagination.getProductName()) : JsonUtil.getObjectToString(yysDayPackagePagination.getProductName()) :
String.valueOf(yysDayPackagePagination.getProductName()); String.valueOf(yysDayPackagePagination.getProductName());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getProductName, value); yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getProductName,value);
} }
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getDeviceName())) { if(ObjectUtil.isNotEmpty(yysDayPackagePagination.getDeviceName())){
yysDayPackageNum++; yysDayPackageNum++;
String value = yysDayPackagePagination.getDeviceName() instanceof List ? String value = yysDayPackagePagination.getDeviceName() instanceof List ?
JsonUtil.getObjectToString(yysDayPackagePagination.getDeviceName()) : JsonUtil.getObjectToString(yysDayPackagePagination.getDeviceName()) :
String.valueOf(yysDayPackagePagination.getDeviceName()); String.valueOf(yysDayPackagePagination.getDeviceName());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getDeviceName, value); yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getDeviceName,value);
} }
} }
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList); List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) { if (total>0){
if (intersection.size() == 0) { if (intersection.size()==0){
intersection.add("jnpfNullList"); intersection.add("jnpfNullList");
} }
yysDayPackageQueryWrapper.lambda().in(YysDayPackageEntity::getId, intersection); yysDayPackageQueryWrapper.lambda().in(YysDayPackageEntity::getId, intersection);
} }
//是否有高级查询 //是否有高级查询
if (StringUtil.isNotEmpty(superOp)) { if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size() == 0) { if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList"); allSuperIDlist.add("jnpfNullList");
} }
List<String> finalAllSuperIDlist = allSuperIDlist; List<String> finalAllSuperIDlist = allSuperIDlist;
yysDayPackageQueryWrapper.lambda().and(t -> t.in(YysDayPackageEntity::getId, finalAllSuperIDlist)); yysDayPackageQueryWrapper.lambda().and(t->t.in(YysDayPackageEntity::getId, finalAllSuperIDlist));
} }
//是否有数据过滤查询 //是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) { if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size() == 0) { if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList"); allRuleIDlist.add("jnpfNullList");
} }
List<String> finalAllRuleIDlist = allRuleIDlist; List<String> finalAllRuleIDlist = allRuleIDlist;
yysDayPackageQueryWrapper.lambda().and(t -> t.in(YysDayPackageEntity::getId, finalAllRuleIDlist)); yysDayPackageQueryWrapper.lambda().and(t->t.in(YysDayPackageEntity::getId, finalAllRuleIDlist));
} }
//假删除标志 //假删除标志
yysDayPackageQueryWrapper.lambda().isNull(YysDayPackageEntity::getDeleteMark); yysDayPackageQueryWrapper.lambda().isNull(YysDayPackageEntity::getDeleteMark);
@ -259,102 +252,93 @@ public class YysDayPackageServiceImpl extends ServiceImpl<YysDayPackageMapper, Y
// } // }
// } // }
if ("0".equals(dataType)) { if("0".equals(dataType)){
if ((total > 0 && AllIdList.size() > 0) || total == 0) { if((total>0 && AllIdList.size()>0) || total==0){
Page<YysDayPackageEntity> page = new Page<>(yysDayPackagePagination.getCurrentPage(), yysDayPackagePagination.getPageSize()); Page<YysDayPackageEntity> page=new Page<>(yysDayPackagePagination.getCurrentPage(), yysDayPackagePagination.getPageSize());
IPage<YysDayPackageEntity> userIPage = this.page(page, yysDayPackageQueryWrapper); IPage<YysDayPackageEntity> userIPage=this.page(page, yysDayPackageQueryWrapper);
return yysDayPackagePagination.setData(userIPage.getRecords(), userIPage.getTotal()); return yysDayPackagePagination.setData(userIPage.getRecords(),userIPage.getTotal());
} else { }else{
List<YysDayPackageEntity> list = new ArrayList(); List<YysDayPackageEntity> list = new ArrayList();
return yysDayPackagePagination.setData(list, list.size()); return yysDayPackagePagination.setData(list, list.size());
} }
} else { }else{
return this.list(yysDayPackageQueryWrapper); return this.list(yysDayPackageQueryWrapper);
} }
} }
@Override @Override
public YysDayPackageEntity getInfo(String id) { public YysDayPackageEntity getInfo(String id){
QueryWrapper<YysDayPackageEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<YysDayPackageEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(YysDayPackageEntity::getId, id); queryWrapper.lambda().eq(YysDayPackageEntity::getId,id);
return this.getOne(queryWrapper); return this.getOne(queryWrapper);
} }
@Override @Override
public void create(YysDayPackageEntity entity) { public void create(YysDayPackageEntity entity){
this.save(entity); this.save(entity);
} }
@Override @Override
public boolean update(String id, YysDayPackageEntity entity) { public boolean update(String id, YysDayPackageEntity entity){
return this.updateById(entity); return this.updateById(entity);
} }
@Override @Override
public void delete(YysDayPackageEntity entity) { public void delete(YysDayPackageEntity entity){
if (entity != null) { if(entity!=null){
this.removeById(entity.getId()); this.removeById(entity.getId());
} }
} }
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override @Override
public String checkForm(YysDayPackageForm form, int i) { public String checkForm(YysDayPackageForm form,int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0"); boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = ""; String id="";
String countRecover = ""; String countRecover = "";
if (isUp) { if (isUp){
id = form.getId(); id = form.getId();
} }
//主表字段验证 //主表字段验证
if (StringUtil.isEmpty(form.getProductCode())) { if(StringUtil.isEmpty(form.getDeviceName())){
return "产品编码不能为空"; return "设备名称不能为空";
} }
if (StringUtil.isNotEmpty(form.getProductName())) { if(StringUtil.isNotEmpty(form.getProductName())){
form.setProductName(form.getProductName().trim()); form.setProductName(form.getProductName().trim());
QueryWrapper<YysDayPackageEntity> productNameWrapper = new QueryWrapper<>(); QueryWrapper<YysDayPackageEntity> productNameWrapper=new QueryWrapper<>();
productNameWrapper.lambda().eq(YysDayPackageEntity::getProductName, form.getProductName()); productNameWrapper.lambda().eq(YysDayPackageEntity::getProductName,form.getProductName());
//假删除标志 //假删除标志
productNameWrapper.lambda().isNull(YysDayPackageEntity::getDeleteMark); productNameWrapper.lambda().isNull(YysDayPackageEntity::getDeleteMark);
if (isUp) { if (isUp){
productNameWrapper.lambda().ne(YysDayPackageEntity::getId, id); productNameWrapper.lambda().ne(YysDayPackageEntity::getId, id);
} }
if ((int) this.count(productNameWrapper) > 0) { if((int) this.count(productNameWrapper)>0){
countRecover = "产品名称不能重复"; countRecover = "产品名称不能重复";
} }
} }
if (StringUtil.isEmpty(form.getModels())) { if(StringUtil.isEmpty(form.getModels())){
return "规格型号不能为空"; return "规格型号不能为空";
} }
if (StringUtil.isEmpty(form.getMeasurementUnit())) { if(StringUtil.isEmpty(form.getMeasurementUnit())){
return "计量单位不能为空"; return "计量单位不能为空";
} }
return countRecover; return countRecover;
} }
/** /**
* () * ()
* * @param id
* @param id * @param yysDayPackageForm
* @param yysDayPackageForm * @return
* @return */
*/
@Override @Override
@Transactional @Transactional
public void saveOrUpdate(YysDayPackageForm yysDayPackageForm, String id, boolean isSave) throws Exception { public void saveOrUpdate(YysDayPackageForm yysDayPackageForm,String id, boolean isSave) throws Exception{
UserInfo userInfo = userProvider.get(); UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId()); UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysDayPackageForm = JsonUtil.getJsonToBean( yysDayPackageForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysDayPackageConstant.getFormData(), yysDayPackageForm), YysDayPackageForm.class); generaterSwapUtil.swapDatetime(YysDayPackageConstant.getFormData(),yysDayPackageForm),YysDayPackageForm.class);
YysDayPackageEntity entity = JsonUtil.getJsonToBean(yysDayPackageForm, YysDayPackageEntity.class); YysDayPackageEntity entity = JsonUtil.getJsonToBean(yysDayPackageForm, YysDayPackageEntity.class);
if (isSave) { if(isSave){
String mainId = RandomUtil.uuId(); String mainId = RandomUtil.uuId() ;
entity.setId(mainId); entity.setId(mainId);
entity.setVersion(0); entity.setVersion(0);
} else { }else{
} }
this.saveOrUpdate(entity); this.saveOrUpdate(entity);

@ -54,7 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-08-06 * @ 2024-08-19
*/ */
@Slf4j @Slf4j
@RestController @RestController

@ -9,7 +9,7 @@ import java.util.Date;
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-08-06 * @ 2024-08-19
*/ */
@Data @Data
@TableName("yys_day_package") @TableName("yys_day_package")
@ -42,7 +42,7 @@ public class YysDayPackageEntity {
private String measurementUnit; private String measurementUnit;
@TableField(value = "PLAN_NUMBER" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "PLAN_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String planNumber; private String planNumber;
@TableField(value = "IS_CONFIRM" , updateStrategy = FieldStrategy.IGNORED) @TableField("IS_CONFIRM")
private String isConfirm; private String isConfirm;
@TableField("F_CREATOR_TIME") @TableField("F_CREATOR_TIME")
private Date creatorTime; private Date creatorTime;

@ -11,7 +11,7 @@ import com.alibaba.fastjson.annotation.JSONField;
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-08-06 * @ 2024-08-19
*/ */
@Data @Data
public class YysDayPackageExcelErrorVO extends YysDayPackageExcelVO{ public class YysDayPackageExcelErrorVO extends YysDayPackageExcelVO{

@ -17,7 +17,7 @@ import java.util.List;
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-08-06 * @ 2024-08-19
*/ */
@Data @Data
public class YysDayPackageExcelVO{ public class YysDayPackageExcelVO{

@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-08-06 * @ 2024-08-19
*/ */
@Data @Data
public class YysDayPackageForm { public class YysDayPackageForm {
@ -34,7 +34,7 @@ public class YysDayPackageForm {
private BigDecimal sort; private BigDecimal sort;
/** 班次 **/ /** 班次 **/
@JsonProperty("post") @JsonProperty("post")
private Object post; private String post;
/** 开始时间 **/ /** 开始时间 **/
@JsonProperty("startTime") @JsonProperty("startTime")
private String startTime; private String startTime;

@ -11,7 +11,7 @@ import java.util.List;
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-08-06 * @ 2024-08-19
*/ */
@Data @Data
public class YysDayPackagePagination extends Pagination { public class YysDayPackagePagination extends Pagination {

@ -26,15 +26,9 @@
<p>{{ dataForm.deviceName }}</p> <p>{{ dataForm.deviceName }}</p>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8">
<jnpf-form-tip-item label="顺序号" prop="sort">
<JnpfNumber v-model="dataForm.sort" placeholder="顺序号" disabled :min="1" :step="1">
</JnpfNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="班次" prop="post"> <jnpf-form-tip-item label="班次" prop="post">
<p>{{ dataForm.post }} </p> <p>{{ dataForm.post }}</p>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -73,6 +67,12 @@
</JnpfNumber> </JnpfNumber>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8">
<jnpf-form-tip-item label="顺序号" prop="sort">
<JnpfNumber v-model="dataForm.sort" placeholder="顺序号" disabled :min="1" :step="1">
</JnpfNumber>
</jnpf-form-tip-item>
</el-col>
</template> </template>
</el-form> </el-form>
</el-row> </el-row>
@ -101,17 +101,15 @@ export default {
deviceCode: "", deviceCode: "",
deviceName: '', deviceName: '',
sort: 1, sort: 1,
post: "1", post: "",
startTime: '', startTime: '',
endTime: '', endTime: "15:55",
productCode: '', productCode: "",
productName: '', productName: '',
models: '', models: '',
measurementUnit: '', measurementUnit: '',
planNumber: '', planNumber: '',
}, },
postOptions: [{ "fullName": "旺季白班", "id": "1" }, { "fullName": "旺季晚班", "id": "2" }],
postProps: { "label": "fullName", "value": "id" },
} }
}, },

@ -4,24 +4,6 @@
<div class="JNPF-common-page-header"> <div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" /> <el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
<div class="options"> <div class="options">
<el-dropdown class="dropdown" placement="bottom">
<el-button style="width:70px">
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<template v-if="dataForm.id">
<el-dropdown-item @click.native="prev" :disabled='prevDis'>
{{ '上一条' }}
</el-dropdown-item>
<el-dropdown-item @click.native="next" :disabled='nextDis'>
{{ '下一条' }}
</el-dropdown-item>
</template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)"
:loading="continueBtnLoading" :disabled='btnLoading'>
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"
:disabled='continueBtnLoading'> :disabled='continueBtnLoading'>
</el-button> </el-button>
@ -37,10 +19,9 @@
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="生产日期" prop="manufactureTime"> <jnpf-form-tip-item label="生产日期" prop="manufactureTime">
<JnpfDatePicker v-model="dataForm.manufactureTime" <JnpfDatePicker v-model="dataForm.manufactureTime"
@change="changeData('manufactureTime', -1)" @change="changeData('manufactureTime', -1)" :startTime="dateTime(false, 1, 1, '', '')"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择生产日期" clearable
placeholder="请选择生产日期" clearable :style='{ "width": "100%" }' type="date" :style='{ "width": "100%" }' type="date" format="yyyy-MM-dd">
format="yyyy-MM-dd">
</JnpfDatePicker> </JnpfDatePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
@ -49,7 +30,7 @@
<JnpfPopupSelect v-model="dataForm.deviceCode" @change="changeData('deviceCode', -1)" <JnpfPopupSelect v-model="dataForm.deviceCode" @change="changeData('deviceCode', -1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.deviceCode" :rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.deviceCode"
placeholder="请选择设备编码" propsValue="device_code" popupWidth="800px" popupTitle="选择数据" placeholder="请选择设备编码" propsValue="device_code" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='device_code' field='deviceCode' popupType="dialog" relationField='device_name' field='deviceCode'
interfaceId="590497496266971845" :pageSize="20" interfaceId="590497496266971845" :pageSize="20"
:columnOptions="deviceCodecolumnOptions" clearable :style='{ "width": "100%" }'> :columnOptions="deviceCodecolumnOptions" clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect> </JnpfPopupSelect>
@ -58,31 +39,27 @@
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="设备名称" prop="deviceName"> <jnpf-form-tip-item label="设备名称" prop="deviceName">
<JnpfInput v-model="dataForm.deviceName" @change="changeData('deviceName', -1)" <JnpfInput v-model="dataForm.deviceName" @change="changeData('deviceName', -1)"
placeholder="选择设备后自动带入" disabled clearable :style='{ "width": "100%" }'> placeholder="请输入设备名称" clearable :style='{ "width": "100%" }'>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8">
<jnpf-form-tip-item label="顺序号" prop="sort">
<JnpfInputNumber v-model="dataForm.sort" @change="changeData('sort', -1)"
placeholder="顺序号" :min="1" :step="1">
</JnpfInputNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="班次" prop="post"> <jnpf-form-tip-item label="班次" prop="post">
<JnpfSelect v-model="dataForm.post" @change="changeData('post', -1)" placeholder="请选择班次" <JnpfPopupSelect v-model="dataForm.post" @change="changeData('post', -1)"
clearable :style='{ "width": "100%" }' :options="postOptions" :props="postProps"> :rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.post"
</JnpfSelect> placeholder="请选择班次" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='classes_name' field='post'
interfaceId="595237502952944325" :pageSize="20" :columnOptions="postcolumnOptions"
clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="开始时间" prop="startTime"> <jnpf-form-tip-item label="开始时间" prop="startTime">
<JnpfTimePicker v-model="dataForm.startTime" @change="changeData('startTime', -1)" <JnpfTimePicker v-model="dataForm.startTime" @change="changeData('startTime', -1)"
:startTime="time(false, 1, 1, '', 'HH:mm', '')" :startTime="time(false, 1, 1, '', 'HH:mm', '')" :endTime="time(false, 1, 1, '', 'HH:mm', '')"
:endTime="time(false, 1, 1, '', 'HH:mm', '')" placeholder="请选择开始时间" clearable placeholder="请选择开始时间" clearable :style='{ "width": "100%" }' format="HH:mm">
:style='{ "width": "100%" }' format="HH:mm">
</JnpfTimePicker> </JnpfTimePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
@ -90,17 +67,20 @@
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="结束时间" prop="endTime"> <jnpf-form-tip-item label="结束时间" prop="endTime">
<JnpfTimePicker v-model="dataForm.endTime" @change="changeData('endTime', -1)" <JnpfTimePicker v-model="dataForm.endTime" @change="changeData('endTime', -1)"
:startTime="time(false, 1, 1, '', 'HH:mm', '')" :startTime="time(false, 1, 1, '', 'HH:mm', '')" :endTime="time(false, 1, 1, '', 'HH:mm', '')"
:endTime="time(false, 1, 1, '', 'HH:mm', '')" placeholder="请选择结束时间" clearable placeholder="请选择结束时间" clearable :style='{ "width": "100%" }' format="HH:mm">
:style='{ "width": "100%" }' format="HH:mm">
</JnpfTimePicker> </JnpfTimePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="产品编码" prop="productCode"> <jnpf-form-tip-item label="产品编码" prop="productCode">
<JnpfInput v-model="dataForm.productCode" @change="changeData('productCode', -1)" <JnpfPopupSelect v-model="dataForm.productCode" @change="changeData('productCode', -1)"
placeholder="请输入产品编码" clearable :style='{ "width": "100%" }'> :rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.productCode"
</JnpfInput> placeholder="请选择产品编码" hasPage propsValue="material_id" popupWidth="800px"
popupTitle="选择数据" popupType="dialog" relationField='material_name'
field='productCode' interfaceId="593079067666820933" :pageSize="20"
:columnOptions="productCodecolumnOptions" clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -119,9 +99,8 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="计量单位" prop="measurementUnit"> <jnpf-form-tip-item label="计量单位" prop="measurementUnit">
<JnpfInput v-model="dataForm.measurementUnit" <JnpfInput v-model="dataForm.measurementUnit" @change="changeData('measurementUnit', -1)"
@change="changeData('measurementUnit', -1)" placeholder="请输入计量单位" clearable placeholder="请输入计量单位" clearable :style='{ "width": "100%" }'>
:style='{ "width": "100%" }'>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
@ -132,6 +111,13 @@
</JnpfInputNumber> </JnpfInputNumber>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8">
<jnpf-form-tip-item label="顺序号" prop="sort">
<JnpfInputNumber v-model="dataForm.sort" @change="changeData('sort', -1)"
placeholder="顺序号" :min="1" :step="1">
</JnpfInputNumber>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 --> <!-- 表单结束 -->
</template> </template>
</el-form> </el-form>
@ -187,9 +173,9 @@ export default {
deviceCode: undefined, deviceCode: undefined,
deviceName: undefined, deviceName: undefined,
sort: 1, sort: 1,
post: "1", post: undefined,
startTime: undefined, startTime: undefined,
endTime: undefined, endTime: "15:55",
productCode: undefined, productCode: undefined,
productName: undefined, productName: undefined,
models: undefined, models: undefined,
@ -214,10 +200,17 @@ export default {
trigger: 'change' trigger: 'change'
}, },
], ],
deviceName: [
{
required: true,
message: '请输入设备名称',
trigger: 'blur'
},
],
post: [ post: [
{ {
required: true, required: true,
message: '请至少选择一个', message: '请选择班次',
trigger: 'change' trigger: 'change'
}, },
], ],
@ -231,15 +224,15 @@ export default {
endTime: [ endTime: [
{ {
required: true, required: true,
message: '请选择结束时间', message: '请至少选择一个',
trigger: 'change' trigger: 'change'
}, },
], ],
productCode: [ productCode: [
{ {
required: true, required: true,
message: '请输入产品编码', message: '请选择产品编码',
trigger: 'blur' trigger: 'change'
}, },
], ],
models: [ models: [
@ -265,8 +258,8 @@ export default {
], ],
}, },
deviceCodecolumnOptions: [{ "label": "设备编码", "value": "device_code" }, { "label": "设备名称", "value": "device_name" }, { "label": "设备类型", "value": "device_desc" },], deviceCodecolumnOptions: [{ "label": "设备编码", "value": "device_code" }, { "label": "设备名称", "value": "device_name" }, { "label": "设备类型", "value": "device_desc" },],
postOptions: [{ "fullName": "旺季白班", "id": "1" }, { "fullName": "旺季晚班", "id": "2" }, { "fullName": "淡季白班", "id": "3" }, { "fullName": "淡季晚班", "id": "4" }], postcolumnOptions: [{ "label": "班次名称", "value": "classes_name" }, { "label": "开始时间", "value": "start_time" }, { "label": "结束时间", "value": "end_time" }, { "label": "班次时长", "value": "classes_duration" },],
postProps: { "label": "fullName", "value": "id" }, productCodecolumnOptions: [{ "label": "产品编码", "value": "material_id" }, { "label": "产品名称", "value": "material_name" }, { "label": "规格型号", "value": "model" }, { "label": "计量单位", "value": "unit_measurement" }, { "label": "安全库存", "value": "safety_stock" },],
childIndex: -1, childIndex: -1,
isEdit: false, isEdit: false,
interfaceRes: { interfaceRes: {
@ -335,12 +328,40 @@ export default {
this.$emit('refreshDataList', true) this.$emit('refreshDataList', true)
}, },
changeData(model, index) { changeData(model, index) {
if (model == 'post' && this.dataForm.post != undefined) {
request({
url: '/api/example/YysClasses/getInfoById/' + this.dataForm.post,
method: 'get'
}).then(res => {
let _data = res.data;
let _dataForm = { ...this.dataForm }
_dataForm.startTime = _data.startTime
_dataForm.endTime = _data.endTime
this.dataForm = { ..._dataForm };
});
}
if (model == 'deviceCode' && this.dataForm.deviceCode != undefined) { if (model == 'deviceCode' && this.dataForm.deviceCode != undefined) {
request({ request({
url: '/api/example/YysDevice/queryNameByCode/' + this.dataForm.deviceCode, url: '/api/example/YysDevice/queryNameByCode/' + this.dataForm.deviceCode,
method: 'get' method: 'get'
}).then(res => { }).then(res => {
this.dataForm.deviceName = res.msg; let _dataForm = { ...this.dataForm }
_dataForm.deviceName = res.msg
this.dataForm = { ..._dataForm };
});
}
if (model == 'productCode' && this.dataForm.productCode != undefined) {
request({
url: '/api/example/YysMaterialInformation/getInfoByCode/' + this.dataForm.productCode,
method: 'get'
}).then(res => {
let _data = res.data;
let _dataForm = { ...this.dataForm }
_dataForm.productName = _data.materialName
_dataForm.models = _data.model
_dataForm.measurementUnit = _data.unitMeasurement
_dataForm.currentInventory = _data.safetyStock
this.dataForm = { ..._dataForm };
}); });
} }
this.isEdit = false this.isEdit = false

@ -196,10 +196,10 @@ export default {
flowListVisible: false, flowListVisible: false,
flowList: [], flowList: [],
exportBoxVisible: false, exportBoxVisible: false,
postOptions: [{ "fullName": "旺季白班", "id": "1" }, { "fullName": "旺季晚班", "id": "2" }],
postProps: { "label": "fullName", "value": "id" },
interfaceRes: { interfaceRes: {
deviceCode: [], deviceCode: [],
post: [],
productCode: [],
}, },
} }
}, },
@ -383,10 +383,10 @@ export default {
const year = now.getFullYear(); const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); const month = String(now.getMonth() + 1).padStart(2, '0');
const startDate = `${year}-${month}-01 00:00:00`; const startDate = `${year}-${month}-01 00:00:00`;
const startDateTimestamp = new Date(startDate).getTime(); const startDateTimestamp = new Date(startDate).getTime();
const endDate = `${year}-${month}-${new Date(year, now.getMonth() + 1, 0).getDate()}`; const endDate = `${year}-${month}-${new Date(year, now.getMonth() + 1, 0).getDate()}`;
const endDateTimestamp = new Date(endDate).getTime(); const endDateTimestamp = new Date(endDate).getTime();
this.query.manufactureTime = [startDateTimestamp, endDateTimestamp]; this.query.manufactureTime = [startDateTimestamp, endDateTimestamp];
}, },
initData() { initData() {
this.listLoading = true; this.listLoading = true;

@ -19,7 +19,7 @@
<jnpf-form-tip-item label="产品编码" prop="productId"> <jnpf-form-tip-item label="产品编码" prop="productId">
<JnpfPopupSelect v-model="dataForm.productId" @change="changeData('productId', -1)" <JnpfPopupSelect v-model="dataForm.productId" @change="changeData('productId', -1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.productId" :rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.productId"
placeholder="请选择产品编码" propsValue="material_id" popupWidth="800px" popupTitle="选择数据" placeholder="请选择产品编码" hasPage propsValue="material_id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='material_name' field='productId' popupType="dialog" relationField='material_name' field='productId'
interfaceId="593079067666820933" :pageSize="20" :columnOptions="productIdcolumnOptions" interfaceId="593079067666820933" :pageSize="20" :columnOptions="productIdcolumnOptions"
clearable :style='{ "width": "100%" }'> clearable :style='{ "width": "100%" }'>

Loading…
Cancel
Save