feat():app后端代码提交

master
jiyufei 2 months ago
parent fd7b77cf02
commit 9c224ed3d1

@ -2,9 +2,13 @@ package jnpf.service;
import jnpf.model.yysdaypackage.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jnpf.model.yysdaywork.ConfirmRequest;
import jnpf.model.yysdaywork.ConfirmResponse;
/**
* yysDayPackage
@ -16,7 +20,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
public interface YysDayPackageService extends IService<YysDayPackageEntity> {
List<YysDayPackageEntity> getList(YysDayPackagePagination yysDayPackagePagination);
List<YysDayPackageEntity> getTypeList(YysDayPackagePagination yysDayPackagePagination,String dataType);
List<YysDayPackageEntity> getTypeList(YysDayPackagePagination yysDayPackagePagination, String dataType);
YysDayPackageEntity getInfo(String id);
@ -28,8 +32,17 @@ public interface YysDayPackageService extends IService<YysDayPackageEntity> {
//子表方法
//副表数据方法
String checkForm(YysDayPackageForm form,int i);
void saveOrUpdate(YysDayPackageForm yysDayPackageForm,String id, boolean isSave) throws Exception;
String checkForm(YysDayPackageForm form, int i);
void saveOrUpdate(YysDayPackageForm yysDayPackageForm, String id, boolean isSave) throws Exception;
/**
* -app
*
* @param groupName
* @param request
* @param requisitonMap
* @return
*/
List<ConfirmResponse> queryList(String groupName, ConfirmRequest request, Map<String, List<YysRequisitionReportEntity>> requisitonMap);
}

@ -2,7 +2,9 @@ package jnpf.service;
import jnpf.model.yysdaywork.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -16,7 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
public interface YysDayWorkService extends IService<YysDayWorkEntity> {
List<YysDayWorkEntity> getList(YysDayWorkPagination yysDayWorkPagination);
List<YysDayWorkEntity> getTypeList(YysDayWorkPagination yysDayWorkPagination,String dataType);
List<YysDayWorkEntity> getTypeList(YysDayWorkPagination yysDayWorkPagination, String dataType);
YysDayWorkEntity getInfo(String id);
@ -28,8 +30,23 @@ public interface YysDayWorkService extends IService<YysDayWorkEntity> {
//子表方法
//副表数据方法
String checkForm(YysDayWorkForm form,int i);
void saveOrUpdate(YysDayWorkForm yysDayWorkForm,String id, boolean isSave) throws Exception;
String checkForm(YysDayWorkForm form, int i);
void saveOrUpdate(YysDayWorkForm yysDayWorkForm, String id, boolean isSave) throws Exception;
/**
* -app
*
* @param request
* @return
*/
List<ConfirmResponse> queryList(ConfirmRequest request);
/**
*
*
* @param request
* @return
*/
String sure(ConfirmResponse request);
}

@ -2,7 +2,9 @@ package jnpf.service;
import jnpf.model.yysgroup.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -16,7 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
public interface YysGroupService extends IService<YysGroupEntity> {
List<YysGroupEntity> getList(YysGroupPagination yysGroupPagination);
List<YysGroupEntity> getTypeList(YysGroupPagination yysGroupPagination,String dataType);
List<YysGroupEntity> getTypeList(YysGroupPagination yysGroupPagination, String dataType);
YysGroupEntity getInfo(String id);
@ -28,8 +30,15 @@ public interface YysGroupService extends IService<YysGroupEntity> {
//子表方法
//副表数据方法
String checkForm(YysGroupForm form,int i);
String checkForm(YysGroupForm form, int i);
void saveOrUpdate(YysGroupForm yysGroupForm,String id, boolean isSave) throws Exception;
void saveOrUpdate(YysGroupForm yysGroupForm, String id, boolean isSave) throws Exception;
/**
* 线
*
* @param userId
* @return
*/
YysGroupEntity queryType(String userId);
}

@ -1,23 +1,37 @@
package jnpf.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import jnpf.entity.*;
import jnpf.mapper.YysDayPackageMapper;
import jnpf.model.yysdaywork.ConfirmRequest;
import jnpf.model.yysdaywork.ConfirmResponse;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysdaypackage.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
@ -25,13 +39,17 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* yysDayPackage
* V3.5
* https://www.jnpfsoft.com
@ -39,177 +57,186 @@ import jnpf.permission.entity.UserEntity;
* 2024-08-06
*/
@Service
public class YysDayPackageServiceImpl extends ServiceImpl<YysDayPackageMapper, YysDayPackageEntity> implements YysDayPackageService{
public class YysDayPackageServiceImpl extends ServiceImpl<YysDayPackageMapper, YysDayPackageEntity> implements YysDayPackageService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private YysDeviceDataService yysDeviceDataService;
@Autowired
private YysPackageReportService yysPackageReportService;
@Override
public List<YysDayPackageEntity> getList(YysDayPackagePagination yysDayPackagePagination){
return getTypeList(yysDayPackagePagination,yysDayPackagePagination.getDataType());
public List<YysDayPackageEntity> getList(YysDayPackagePagination yysDayPackagePagination) {
return getTypeList(yysDayPackagePagination, yysDayPackagePagination.getDataType());
}
/** 列表查询 */
/**
*
*/
@Override
public List<YysDayPackageEntity> getTypeList(YysDayPackagePagination yysDayPackagePagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
public List<YysDayPackageEntity> getTypeList(YysDayPackagePagination yysDayPackagePagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? YysDayPackageConstant.getAppColumnData() : YysDayPackageConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int yysDayPackageNum =0;
QueryWrapper<YysDayPackageEntity> yysDayPackageQueryWrapper=new QueryWrapper<>();
int total = 0;
int yysDayPackageNum = 0;
QueryWrapper<YysDayPackageEntity> yysDayPackageQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getSuperQueryJson())){
String superOp = "";
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = yysDayPackagePagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
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();
if (yysDayPackageNum1>0){
List<String> yysDayPackageList =this.list(yysDayPackageSuperWrapper).stream().map(YysDayPackageEntity::getId).collect(Collectors.toList());
if (yysDayPackageNum1 > 0) {
List<String> yysDayPackageList = this.list(yysDayPackageSuperWrapper).stream().map(YysDayPackageEntity::getId).collect(Collectors.toList());
allSuperList.addAll(yysDayPackageList);
intersectionSuperList.add(yysDayPackageList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
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();
if (yysDayPackageNum1>0){
List<String> yysDayPackageList =this.list(yysDayPackageSuperWrapper).stream().map(YysDayPackageEntity::getId).collect(Collectors.toList());
if (yysDayPackageNum1 > 0) {
List<String> yysDayPackageList = this.list(yysDayPackageSuperWrapper).stream().map(YysDayPackageEntity::getId).collect(Collectors.toList());
allRuleList.addAll(yysDayPackageList);
intersectionRuleList.add(yysDayPackageList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
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++;
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
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(ObjectUtil.isNotEmpty(yysDayPackagePagination.getManufactureTime())){
yysDayPackageNum++;
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getManufactureTime())) {
yysDayPackageNum++;
List ManufactureTimeList = JsonUtil.getJsonToList(yysDayPackagePagination.getManufactureTime(),String.class);
Long fir = Long.valueOf(String.valueOf(ManufactureTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(ManufactureTimeList.get(1)));
List ManufactureTimeList = JsonUtil.getJsonToList(yysDayPackagePagination.getManufactureTime(), String.class);
Long fir = Long.valueOf(String.valueOf(ManufactureTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(ManufactureTimeList.get(1)));
yysDayPackageQueryWrapper.lambda().ge(YysDayPackageEntity::getManufactureTime, new Date(fir))
.le(YysDayPackageEntity::getManufactureTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
yysDayPackageQueryWrapper.lambda().ge(YysDayPackageEntity::getManufactureTime, new Date(fir))
.le(YysDayPackageEntity::getManufactureTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(yysDayPackagePagination.getProductCode())){
yysDayPackageNum++;
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getProductCode())) {
yysDayPackageNum++;
String value = yysDayPackagePagination.getProductCode() instanceof List ?
JsonUtil.getObjectToString(yysDayPackagePagination.getProductCode()) :
String.valueOf(yysDayPackagePagination.getProductCode());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getProductCode,value);
JsonUtil.getObjectToString(yysDayPackagePagination.getProductCode()) :
String.valueOf(yysDayPackagePagination.getProductCode());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getProductCode, value);
}
if(ObjectUtil.isNotEmpty(yysDayPackagePagination.getProductName())){
yysDayPackageNum++;
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getProductName())) {
yysDayPackageNum++;
String value = yysDayPackagePagination.getProductName() instanceof List ?
JsonUtil.getObjectToString(yysDayPackagePagination.getProductName()) :
String.valueOf(yysDayPackagePagination.getProductName());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getProductName,value);
JsonUtil.getObjectToString(yysDayPackagePagination.getProductName()) :
String.valueOf(yysDayPackagePagination.getProductName());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getProductName, value);
}
if(ObjectUtil.isNotEmpty(yysDayPackagePagination.getDeviceName())){
yysDayPackageNum++;
if (ObjectUtil.isNotEmpty(yysDayPackagePagination.getDeviceName())) {
yysDayPackageNum++;
String value = yysDayPackagePagination.getDeviceName() instanceof List ?
JsonUtil.getObjectToString(yysDayPackagePagination.getDeviceName()) :
String.valueOf(yysDayPackagePagination.getDeviceName());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getDeviceName,value);
JsonUtil.getObjectToString(yysDayPackagePagination.getDeviceName()) :
String.valueOf(yysDayPackagePagination.getDeviceName());
yysDayPackageQueryWrapper.lambda().like(YysDayPackageEntity::getDeviceName, value);
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
yysDayPackageQueryWrapper.lambda().in(YysDayPackageEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
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 (allRuleIDlist.size()==0){
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
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);
@ -232,95 +259,169 @@ public class YysDayPackageServiceImpl extends ServiceImpl<YysDayPackageMapper, Y
// }
// }
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<YysDayPackageEntity> page=new Page<>(yysDayPackagePagination.getCurrentPage(), yysDayPackagePagination.getPageSize());
IPage<YysDayPackageEntity> userIPage=this.page(page, yysDayPackageQueryWrapper);
return yysDayPackagePagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<YysDayPackageEntity> page = new Page<>(yysDayPackagePagination.getCurrentPage(), yysDayPackagePagination.getPageSize());
IPage<YysDayPackageEntity> userIPage = this.page(page, yysDayPackageQueryWrapper);
return yysDayPackagePagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<YysDayPackageEntity> list = new ArrayList();
return yysDayPackagePagination.setData(list, list.size());
}
}else{
} else {
return this.list(yysDayPackageQueryWrapper);
}
}
@Override
public YysDayPackageEntity getInfo(String id){
QueryWrapper<YysDayPackageEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(YysDayPackageEntity::getId,id);
public YysDayPackageEntity getInfo(String id) {
QueryWrapper<YysDayPackageEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(YysDayPackageEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(YysDayPackageEntity entity){
public void create(YysDayPackageEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, YysDayPackageEntity entity){
public boolean update(String id, YysDayPackageEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(YysDayPackageEntity entity){
if(entity!=null){
public void delete(YysDayPackageEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override
public String checkForm(YysDayPackageForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
public String checkForm(YysDayPackageForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp){
if (isUp) {
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getProductCode())){
return "产品编码不能为空";
}
if(StringUtil.isNotEmpty(form.getProductName())){
form.setProductName(form.getProductName().trim());
QueryWrapper<YysDayPackageEntity> productNameWrapper=new QueryWrapper<>();
productNameWrapper.lambda().eq(YysDayPackageEntity::getProductName,form.getProductName());
//假删除标志
productNameWrapper.lambda().isNull(YysDayPackageEntity::getDeleteMark);
if (isUp){
productNameWrapper.lambda().ne(YysDayPackageEntity::getId, id);
}
if((int) this.count(productNameWrapper)>0){
countRecover = "产品名称不能重复";
}
}
if(StringUtil.isEmpty(form.getModels())){
return "规格型号不能为空";
}
if(StringUtil.isEmpty(form.getMeasurementUnit())){
return "计量单位不能为空";
}
if (StringUtil.isEmpty(form.getProductCode())) {
return "产品编码不能为空";
}
if (StringUtil.isNotEmpty(form.getProductName())) {
form.setProductName(form.getProductName().trim());
QueryWrapper<YysDayPackageEntity> productNameWrapper = new QueryWrapper<>();
productNameWrapper.lambda().eq(YysDayPackageEntity::getProductName, form.getProductName());
//假删除标志
productNameWrapper.lambda().isNull(YysDayPackageEntity::getDeleteMark);
if (isUp) {
productNameWrapper.lambda().ne(YysDayPackageEntity::getId, id);
}
if ((int) this.count(productNameWrapper) > 0) {
countRecover = "产品名称不能重复";
}
}
if (StringUtil.isEmpty(form.getModels())) {
return "规格型号不能为空";
}
if (StringUtil.isEmpty(form.getMeasurementUnit())) {
return "计量单位不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param yysDayPackageForm
* @return
*/
* ()
*
* @param id
* @param yysDayPackageForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(YysDayPackageForm yysDayPackageForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
public void saveOrUpdate(YysDayPackageForm yysDayPackageForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysDayPackageForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysDayPackageConstant.getFormData(),yysDayPackageForm),YysDayPackageForm.class);
generaterSwapUtil.swapDatetime(YysDayPackageConstant.getFormData(), yysDayPackageForm), YysDayPackageForm.class);
YysDayPackageEntity entity = JsonUtil.getJsonToBean(yysDayPackageForm, YysDayPackageEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
if (isSave) {
String mainId = RandomUtil.uuId();
entity.setId(mainId);
entity.setVersion(0);
}else{
} else {
}
this.saveOrUpdate(entity);
}
@Override
public List<ConfirmResponse> queryList(String groupName, ConfirmRequest request, Map<String, List<YysRequisitionReportEntity>> requisitonMap) {
//查询所有待确认的数据
LambdaQueryWrapper<YysDayPackageEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YysDayPackageEntity::getIsConfirm, request.getFlag());
List<YysDayPackageEntity> root = this.list(wrapper);
if (org.apache.commons.collections4.CollectionUtils.isEmpty(root)) {
return Collections.emptyList();
}
//构建查询条件
Set<String> deviceCodes = root.stream().map(YysDayPackageEntity::getDeviceCode).collect(Collectors.toSet());
Set<Date> dates = root.stream().map(YysDayPackageEntity::getManufactureTime).collect(Collectors.toSet());
//数采表符合条件的数据
LambdaQueryWrapper<YysDeviceDataEntity> queryWrapper = new LambdaQueryWrapper<>(YysDeviceDataEntity.class);
queryWrapper.in(YysDeviceDataEntity::getProductionTime, dates);
queryWrapper.in(YysDeviceDataEntity::getProductionLine, deviceCodes);
List<YysDeviceDataEntity> data = yysDeviceDataService.list(queryWrapper);
if (CollectionUtils.isEmpty(data)) {
return Collections.emptyList();
}
//数采数据根据生产时间和产线分组 相加当日生产数量
Map<String, Integer> resultMap = data.stream()
.collect(Collectors.groupingBy(
item -> item.getProductionTime() + "-" + item.getProductionLine(),
Collectors.mapping(
item -> Integer.parseInt(item.getDayNum()),
Collectors.summingInt(i -> i)
)
));
//再将工单分组
Map<String, List<YysDayPackageEntity>> rootMap = root.stream()
.collect(Collectors.groupingBy(obj -> String.join("-", obj.getManufactureTime().toString(), obj.getDeviceCode())));
//查询报工确认数据
List<YysPackageReportEntity> reportEntityList = yysPackageReportService.list();
Map<String, List<YysPackageReportEntity>> packMap = reportEntityList.stream().collect(Collectors.groupingBy(YysPackageReportEntity::getWorkId));
//进行平均分配
List<ConfirmResponse> result = Lists.newArrayList();
for (Map.Entry<String, List<YysDayPackageEntity>> entry : rootMap.entrySet()) {
if (resultMap.containsKey(entry.getKey())) {
Integer total = resultMap.get(entry.getKey());
List<YysDayPackageEntity> collected = entry.getValue().stream().sorted(Comparator.comparing(YysDayPackageEntity::getSort)).collect(Collectors.toList());
for (YysDayPackageEntity packageEntity : collected) {
ConfirmResponse confirmResponse = BeanUtil.copyProperties(packageEntity, ConfirmResponse.class);
confirmResponse.setGroupName(groupName);
if (packMap.containsKey(packageEntity.getId())) {
confirmResponse.setPackageReportList(packMap.get(packageEntity.getId()));
}
if (requisitonMap.containsKey(packageEntity.getId())) {
confirmResponse.setRequisitionReportList(requisitonMap.get(packageEntity.getId()));
}
if (Integer.parseInt(packageEntity.getPlanNumber()) <= total) {
confirmResponse.setIsConfirmNums(packageEntity.getPlanNumber());
total -= Integer.parseInt(packageEntity.getPlanNumber());
result.add(confirmResponse);
} else {
confirmResponse.setIsConfirmNums(total.toString());
result.add(confirmResponse);
break;
}
}
}
}
return result;
}
}

@ -1,5 +1,9 @@
package jnpf.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import jnpf.base.ActionResult;
import jnpf.entity.*;
import jnpf.mapper.YysDayWorkMapper;
import jnpf.service.*;
@ -30,6 +34,7 @@ import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
@ -62,6 +67,24 @@ public class YysDayWorkServiceImpl extends ServiceImpl<YysDayWorkMapper, YysDayW
@Autowired
private UserProvider userProvider;
@Autowired
private YysGroupService yysGroupService;
@Autowired
private YysProdReportService yysProdReportService;
@Autowired
private YysPackageReportService yysPackageReportService;
@Autowired
private YysDayPackageService yysDayPackageService;
@Autowired
private YysDeviceDataService yysDeviceDataService;
@Autowired
private YysRequisitionReportService yysRequisitionReportService;
@Override
public List<YysDayWorkEntity> getList(YysDayWorkPagination yysDayWorkPagination) {
return getTypeList(yysDayWorkPagination, yysDayWorkPagination.getDataType());
@ -409,4 +432,114 @@ public class YysDayWorkServiceImpl extends ServiceImpl<YysDayWorkMapper, YysDayW
this.saveOrUpdate(entity);
}
@Override
public List<ConfirmResponse> queryList(ConfirmRequest request) {
//根据登陆人判断属于生产还是包装线
YysGroupEntity yysGroupEntity = yysGroupService.queryType(userProvider.get().getUserId());
if (ObjectUtil.isNull(yysGroupEntity)) {
return Collections.emptyList();
}
//领料上报
List<YysRequisitionReportEntity> list = yysRequisitionReportService.list();
Map<String, List<YysRequisitionReportEntity>> requisitonMap = list.stream().collect(Collectors.groupingBy(YysRequisitionReportEntity::getWorkId));
if ("2".equals(yysGroupEntity.getGroupType())) {
return yysDayPackageService.queryList(yysGroupEntity.getGroupName(), request, requisitonMap);
}
//查询所有待确认的数据
LambdaQueryWrapper<YysDayWorkEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YysDayWorkEntity::getIsConfirm, request.getFlag());
List<YysDayWorkEntity> root = this.list(wrapper);
if (CollectionUtils.isEmpty(root)) {
return Collections.emptyList();
}
//构建查询条件
Set<String> deviceCodes = root.stream().map(YysDayWorkEntity::getDeviceCode).collect(Collectors.toSet());
Set<Date> dates = root.stream().map(YysDayWorkEntity::getManufactureTime).collect(Collectors.toSet());
//数采表符合条件的数据
LambdaQueryWrapper<YysDeviceDataEntity> queryWrapper = new LambdaQueryWrapper<>(YysDeviceDataEntity.class);
queryWrapper.in(YysDeviceDataEntity::getProductionTime, dates);
queryWrapper.in(YysDeviceDataEntity::getProductionLine, deviceCodes);
List<YysDeviceDataEntity> data = yysDeviceDataService.list(queryWrapper);
if (CollectionUtils.isEmpty(data)) {
return Collections.emptyList();
}
//数采数据根据生产时间和产线分组 相加当日生产数量
Map<String, Integer> resultMap = data.stream()
.collect(Collectors.groupingBy(
item -> item.getProductionTime() + "-" + item.getProductionLine(),
Collectors.mapping(
item -> Integer.parseInt(item.getDayNum()),
Collectors.summingInt(i -> i)
)
));
//再将工单分组
Map<String, List<YysDayWorkEntity>> rootMap = root.stream()
.collect(Collectors.groupingBy(obj -> String.join("-", obj.getManufactureTime().toString(), obj.getDeviceCode())));
//查询报工确认数据
List<YysProdReportEntity> reportEntityList = yysProdReportService.list();
Map<String, List<YysProdReportEntity>> prodMap = reportEntityList.stream().collect(Collectors.groupingBy(YysProdReportEntity::getWorkId));
//进行平均分配
List<ConfirmResponse> result = Lists.newArrayList();
for (Map.Entry<String, List<YysDayWorkEntity>> entry : rootMap.entrySet()) {
if (resultMap.containsKey(entry.getKey())) {
Integer total = resultMap.get(entry.getKey());
List<YysDayWorkEntity> collected = entry.getValue().stream().sorted(Comparator.comparing(YysDayWorkEntity::getSort)).collect(Collectors.toList());
for (YysDayWorkEntity dayWork : collected) {
ConfirmResponse confirmResponse = BeanUtil.copyProperties(dayWork, ConfirmResponse.class);
confirmResponse.setGroupName(yysGroupEntity.getGroupName());
if (prodMap.containsKey(dayWork.getId())) {
confirmResponse.setProdReportList(prodMap.get(dayWork.getId()));
}
if (requisitonMap.containsKey(dayWork.getId())) {
confirmResponse.setRequisitionReportList(requisitonMap.get(dayWork.getId()));
}
if (Integer.parseInt(dayWork.getPlanNumber()) <= total) {
confirmResponse.setIsConfirmNums(dayWork.getPlanNumber());
total -= Integer.parseInt(dayWork.getPlanNumber());
result.add(confirmResponse);
} else {
confirmResponse.setIsConfirmNums(total.toString());
result.add(confirmResponse);
break;
}
}
}
}
return result;
}
@Override
public String sure(ConfirmResponse request) {
boolean prodResult = false;
boolean packResult = false;
boolean requisitionResult = false;
if (CollectionUtils.isNotEmpty(request.getProdReportList())) {
for (YysProdReportEntity entity : request.getProdReportList()) {
BeanUtil.copyProperties(request, entity);
entity.setWorkId(request.getId());
entity.setStatus("1");
}
prodResult = yysProdReportService.saveBatch(request.getProdReportList());
}
if (CollectionUtils.isNotEmpty(request.getPackageReportList())) {
for (YysPackageReportEntity entity : request.getPackageReportList()) {
BeanUtil.copyProperties(request, entity);
entity.setWorkId(request.getId());
entity.setStatus("1");
}
packResult = yysPackageReportService.saveBatch(request.getPackageReportList());
}
if (CollectionUtils.isNotEmpty(request.getRequisitionReportList())) {
for (YysRequisitionReportEntity entity : request.getRequisitionReportList()) {
BeanUtil.copyProperties(request, entity);
entity.setWorkId(request.getId());
}
requisitionResult = yysRequisitionReportService.saveBatch(request.getRequisitionReportList());
}
if ((prodResult && requisitionResult) || (packResult && requisitionResult)) {
return "确认成功";
}
return "确认失败";
}
}

@ -1,23 +1,33 @@
package jnpf.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jnpf.entity.*;
import jnpf.mapper.YysGroupMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysgroup.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
@ -25,13 +35,17 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* yysGroup
* V3.5
* https://www.jnpfsoft.com
@ -39,7 +53,7 @@ import jnpf.permission.entity.UserEntity;
* 2024-08-05
*/
@Service
public class YysGroupServiceImpl extends ServiceImpl<YysGroupMapper, YysGroupEntity> implements YysGroupService{
public class YysGroupServiceImpl extends ServiceImpl<YysGroupMapper, YysGroupEntity> implements YysGroupService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@ -47,261 +61,284 @@ public class YysGroupServiceImpl extends ServiceImpl<YysGroupMapper, YysGroupEnt
private UserProvider userProvider;
@Override
public List<YysGroupEntity> getList(YysGroupPagination yysGroupPagination){
return getTypeList(yysGroupPagination,yysGroupPagination.getDataType());
public List<YysGroupEntity> getList(YysGroupPagination yysGroupPagination) {
return getTypeList(yysGroupPagination, yysGroupPagination.getDataType());
}
/** 列表查询 */
/**
*
*/
@Override
public List<YysGroupEntity> getTypeList(YysGroupPagination yysGroupPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
public List<YysGroupEntity> getTypeList(YysGroupPagination yysGroupPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? YysGroupConstant.getAppColumnData() : YysGroupConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int yysGroupNum =0;
QueryWrapper<YysGroupEntity> yysGroupQueryWrapper=new QueryWrapper<>();
int total = 0;
int yysGroupNum = 0;
QueryWrapper<YysGroupEntity> yysGroupQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(yysGroupPagination.getSuperQueryJson())){
String superOp = "";
if (ObjectUtil.isNotEmpty(yysGroupPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = yysGroupPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<YysGroupEntity> yysGroupSuperWrapper = new QueryWrapper<>();
yysGroupSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysGroupSuperWrapper,YysGroupEntity.class,queryJson,"0"));
yysGroupSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysGroupSuperWrapper, YysGroupEntity.class, queryJson, "0"));
int yysGroupNum1 = yysGroupSuperWrapper.getExpression().getNormal().size();
if (yysGroupNum1>0){
List<String> yysGroupList =this.list(yysGroupSuperWrapper).stream().map(YysGroupEntity::getId).collect(Collectors.toList());
if (yysGroupNum1 > 0) {
List<String> yysGroupList = this.list(yysGroupSuperWrapper).stream().map(YysGroupEntity::getId).collect(Collectors.toList());
allSuperList.addAll(yysGroupList);
intersectionSuperList.add(yysGroupList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<YysGroupEntity> yysGroupSuperWrapper = new QueryWrapper<>();
yysGroupSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysGroupSuperWrapper,YysGroupEntity.class,ruleJson,"0"));
yysGroupSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysGroupSuperWrapper, YysGroupEntity.class, ruleJson, "0"));
int yysGroupNum1 = yysGroupSuperWrapper.getExpression().getNormal().size();
if (yysGroupNum1>0){
List<String> yysGroupList =this.list(yysGroupSuperWrapper).stream().map(YysGroupEntity::getId).collect(Collectors.toList());
if (yysGroupNum1 > 0) {
List<String> yysGroupList = this.list(yysGroupSuperWrapper).stream().map(YysGroupEntity::getId).collect(Collectors.toList());
allRuleList.addAll(yysGroupList);
intersectionRuleList.add(yysGroupList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object yysGroupObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysGroupQueryWrapper,YysGroupEntity.class,yysGroupPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(yysGroupObj)){
return new ArrayList<>();
} else {
yysGroupQueryWrapper = (QueryWrapper<YysGroupEntity>)yysGroupObj;
if( yysGroupQueryWrapper.getExpression().getNormal().size()>0){
yysGroupNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object yysGroupObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysGroupQueryWrapper,YysGroupEntity.class,yysGroupPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(yysGroupObj)){
return new ArrayList<>();
} else {
yysGroupQueryWrapper = (QueryWrapper<YysGroupEntity>)yysGroupObj;
if( yysGroupQueryWrapper.getExpression().getNormal().size()>0){
yysGroupNum++;
}
boolean pcPermission = false;
boolean appPermission = false;
if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object yysGroupObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysGroupQueryWrapper, YysGroupEntity.class, yysGroupPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(yysGroupObj)) {
return new ArrayList<>();
} else {
yysGroupQueryWrapper = (QueryWrapper<YysGroupEntity>) yysGroupObj;
if (yysGroupQueryWrapper.getExpression().getNormal().size() > 0) {
yysGroupNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object yysGroupObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysGroupQueryWrapper, YysGroupEntity.class, yysGroupPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(yysGroupObj)) {
return new ArrayList<>();
} else {
yysGroupQueryWrapper = (QueryWrapper<YysGroupEntity>) yysGroupObj;
if (yysGroupQueryWrapper.getExpression().getNormal().size() > 0) {
yysGroupNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(yysGroupPagination.getGroupName())){
yysGroupNum++;
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(yysGroupPagination.getGroupName())) {
yysGroupNum++;
String value = yysGroupPagination.getGroupName() instanceof List ?
JsonUtil.getObjectToString(yysGroupPagination.getGroupName()) :
String.valueOf(yysGroupPagination.getGroupName());
yysGroupQueryWrapper.lambda().like(YysGroupEntity::getGroupName,value);
JsonUtil.getObjectToString(yysGroupPagination.getGroupName()) :
String.valueOf(yysGroupPagination.getGroupName());
yysGroupQueryWrapper.lambda().like(YysGroupEntity::getGroupName, value);
}
if(ObjectUtil.isNotEmpty(yysGroupPagination.getEnabledStatus())){
yysGroupNum++;
if (ObjectUtil.isNotEmpty(yysGroupPagination.getEnabledStatus())) {
yysGroupNum++;
List<String> idList = new ArrayList<>();
try {
String[][] enabledStatus = JsonUtil.getJsonToBean(yysGroupPagination.getEnabledStatus(),String[][].class);
for(int i=0;i<enabledStatus.length;i++){
if(enabledStatus[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(enabledStatus[i])));
}
}
}catch (Exception e1){
try {
List<String> enabledStatus = JsonUtil.getJsonToList(yysGroupPagination.getEnabledStatus(),String.class);
if(enabledStatus.size()>0){
idList.addAll(enabledStatus);
}
}catch (Exception e2){
idList.add(String.valueOf(yysGroupPagination.getEnabledStatus()));
}
}
yysGroupQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(YysGroupEntity::getEnabledStatus, tt).or();
});
});
List<String> idList = new ArrayList<>();
try {
String[][] enabledStatus = JsonUtil.getJsonToBean(yysGroupPagination.getEnabledStatus(), String[][].class);
for (int i = 0; i < enabledStatus.length; i++) {
if (enabledStatus[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(enabledStatus[i])));
}
}
} catch (Exception e1) {
try {
List<String> enabledStatus = JsonUtil.getJsonToList(yysGroupPagination.getEnabledStatus(), String.class);
if (enabledStatus.size() > 0) {
idList.addAll(enabledStatus);
}
} catch (Exception e2) {
idList.add(String.valueOf(yysGroupPagination.getEnabledStatus()));
}
}
yysGroupQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(YysGroupEntity::getEnabledStatus, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
yysGroupQueryWrapper.lambda().in(YysGroupEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
yysGroupQueryWrapper.lambda().and(t->t.in(YysGroupEntity::getId, finalAllSuperIDlist));
yysGroupQueryWrapper.lambda().and(t -> t.in(YysGroupEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
yysGroupQueryWrapper.lambda().and(t->t.in(YysGroupEntity::getId, finalAllRuleIDlist));
yysGroupQueryWrapper.lambda().and(t -> t.in(YysGroupEntity::getId, finalAllRuleIDlist));
}
//假删除标志
yysGroupQueryWrapper.lambda().isNull(YysGroupEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(yysGroupPagination.getSidx())){
if (StringUtil.isEmpty(yysGroupPagination.getSidx())) {
yysGroupQueryWrapper.lambda().orderByDesc(YysGroupEntity::getId);
}else{
} else {
try {
String sidx = yysGroupPagination.getSidx();
String[] strs= sidx.split("_name");
String[] strs = sidx.split("_name");
YysGroupEntity yysGroupEntity = new YysGroupEntity();
Field declaredField = yysGroupEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
yysGroupQueryWrapper="asc".equals(yysGroupPagination.getSort().toLowerCase())?yysGroupQueryWrapper.orderByAsc(value):yysGroupQueryWrapper.orderByDesc(value);
yysGroupQueryWrapper = "asc".equals(yysGroupPagination.getSort().toLowerCase()) ? yysGroupQueryWrapper.orderByAsc(value) : yysGroupQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<YysGroupEntity> page=new Page<>(yysGroupPagination.getCurrentPage(), yysGroupPagination.getPageSize());
IPage<YysGroupEntity> userIPage=this.page(page, yysGroupQueryWrapper);
return yysGroupPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<YysGroupEntity> page = new Page<>(yysGroupPagination.getCurrentPage(), yysGroupPagination.getPageSize());
IPage<YysGroupEntity> userIPage = this.page(page, yysGroupQueryWrapper);
return yysGroupPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<YysGroupEntity> list = new ArrayList();
return yysGroupPagination.setData(list, list.size());
}
}else{
} else {
return this.list(yysGroupQueryWrapper);
}
}
@Override
public YysGroupEntity getInfo(String id){
QueryWrapper<YysGroupEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(YysGroupEntity::getId,id);
public YysGroupEntity getInfo(String id) {
QueryWrapper<YysGroupEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(YysGroupEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(YysGroupEntity entity){
public void create(YysGroupEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, YysGroupEntity entity){
public boolean update(String id, YysGroupEntity entity) {
entity.setDeleteTime(DateUtil.getNowDate());
return this.updateById(entity);
}
@Override
public void delete(YysGroupEntity entity){
if(entity!=null){
public void delete(YysGroupEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override
public String checkForm(YysGroupForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
public String checkForm(YysGroupForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp){
if (isUp) {
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getGroupName())){
return "班组名称不能为空";
}
if (StringUtil.isEmpty(form.getGroupName())) {
return "班组名称不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param yysGroupForm
* @return
*/
* ()
*
* @param id
* @param yysGroupForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(YysGroupForm yysGroupForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
public void saveOrUpdate(YysGroupForm yysGroupForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysGroupForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysGroupConstant.getFormData(),yysGroupForm),YysGroupForm.class);
generaterSwapUtil.swapDatetime(YysGroupConstant.getFormData(), yysGroupForm), YysGroupForm.class);
YysGroupEntity entity = JsonUtil.getJsonToBean(yysGroupForm, YysGroupEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
if (isSave) {
String mainId = RandomUtil.uuId();
entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userInfo.getUserId());
entity.setId(mainId);
entity.setVersion(0);
}else{
} else {
entity.setLastModifyTime(DateUtil.getNowDate());
entity.setLastModifyUserId(userInfo.getUserId());
}
this.saveOrUpdate(entity);
}
@Override
public YysGroupEntity queryType(String userId) {
LambdaQueryWrapper<YysGroupEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YysGroupEntity::getLeader, userId);
List<YysGroupEntity> list = this.list(wrapper);
if (CollectionUtils.isEmpty(list) || list.size() > 1) {
return new YysGroupEntity();
}
return list.get(0);
}
}

@ -1,59 +1,49 @@
package jnpf.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.xuyanwu.spring.file.storage.FileInfo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.yysdaywork.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import jnpf.base.vo.DownloadVO;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.entity.YysDayWorkEntity;
import jnpf.entity.YysGroupEntity;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.model.yysdaywork.*;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import jnpf.service.YysDayPackageService;
import jnpf.service.YysDayWorkService;
import jnpf.service.YysGroupService;
import jnpf.util.*;
import lombok.Cleanup;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.io.File;
import java.io.IOException;
import java.util.*;
/**
* yysDayWork
@ -78,7 +68,6 @@ public class YysDayWorkController {
@Autowired
private YysDayWorkService yysDayWorkService;
@Autowired
private ConfigValueUtil configValueUtil;
@ -550,4 +539,20 @@ public class YysDayWorkController {
return ActionResult.success(yysDayWorkMap);
}
@Operation(summary = "报工确认列表-app")
@PostMapping("confirm")
public ActionResult confirm(@RequestBody ConfirmRequest request) {
return ActionResult.success(yysDayWorkService.queryList(request));
}
@Operation(summary = "报工确认-app")
@PostMapping("sure")
public ActionResult sure(@RequestBody ConfirmResponse request) {
String result = yysDayWorkService.sure(request);
if (result.contains("成功")) {
return ActionResult.success(result);
}
return ActionResult.fail(result);
}
}

@ -40,6 +40,8 @@ public class YysDayPackageEntity {
private String measurementUnit;
@TableField(value = "PLAN_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String planNumber;
@TableField(value = "IS_CONFIRM" , updateStrategy = FieldStrategy.IGNORED)
private String isConfirm;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")

@ -46,6 +46,8 @@ public class YysDayWorkEntity {
private String productionStatus;
@TableField("DELIVERY_TIME")
private Date deliveryTime;
@TableField(value = "IS_CONFIRM" , updateStrategy = FieldStrategy.IGNORED)
private String isConfirm;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")

@ -17,6 +17,8 @@ import java.math.BigDecimal;
public class YysPackageReportEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "WORK_ID" , updateStrategy = FieldStrategy.IGNORED)
private String workId;
@TableField(value = "MANUFACTURE_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date manufactureTime;
@TableField(value = "DEVICE_CODE" , updateStrategy = FieldStrategy.IGNORED)

@ -17,6 +17,8 @@ import java.math.BigDecimal;
public class YysProdReportEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "WORK_ID" , updateStrategy = FieldStrategy.IGNORED)
private String workId;
@TableField(value = "MANUFACTURE_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date manufactureTime;
@TableField(value = "DEVICE_CODE" , updateStrategy = FieldStrategy.IGNORED)

@ -16,6 +16,8 @@ import java.util.Date;
public class YysRequisitionReportEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "WORK_ID" , updateStrategy = FieldStrategy.IGNORED)
private String workId;
@TableField(value = "MANUFACTURE_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date manufactureTime;
@TableField(value = "DEVICE_CODE" , updateStrategy = FieldStrategy.IGNORED)

@ -0,0 +1,22 @@
package jnpf.model.yysdaywork;
import lombok.Data;
@Data
public class ConfirmRequest {
/**
* id
*/
private String workId;
/**
* 线
*/
private String line;
/**
* /
*/
private String flag;
}

@ -0,0 +1,64 @@
package jnpf.model.yysdaywork;
import jnpf.entity.YysPackageReportEntity;
import jnpf.entity.YysProdReportEntity;
import jnpf.entity.YysRequisitionReportEntity;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ConfirmResponse {
private String id;
private String monthId;
private Date manufactureTime;
private String deviceCode;
private String deviceName;
private Integer sort;
private String post;
private String startTime;
private String endTime;
private String productCode;
private String productName;
private String models;
private String measurementUnit;
private String planNumber;
private String productionStatus;
private Date deliveryTime;
/**
*
*/
private String acquisitionNum;
/**
*
*/
private String defectiveNum;
/**
*
*/
private String qualifiedNum;
/**
*
*/
private String isConfirmNums;
/**
*
*/
private String groupName;
/**
*
*/
List<YysProdReportEntity> prodReportList;
/**
*
*/
List<YysPackageReportEntity> packageReportList;
/**
*
*/
List<YysRequisitionReportEntity> requisitionReportList;
}
Loading…
Cancel
Save