master
zengchenxi 3 months ago
parent d98fbb681b
commit 5f03fabb38

@ -4,7 +4,6 @@ import jnpf.model.yysmonthlyproduction.*;
import jnpf.entity.*; import jnpf.entity.*;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/** /**
* yysMonthlyProduction * yysMonthlyProduction
@ -30,6 +29,6 @@ public interface YysMonthlyProductionService extends IService<YysMonthlyProducti
//副表数据方法 //副表数据方法
String checkForm(YysMonthlyProductionForm form,int i); String checkForm(YysMonthlyProductionForm form,int i);
void saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm,String id, boolean isSave) throws Exception; String saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm, String id, boolean isSave) ;
} }

@ -1,23 +1,23 @@
package jnpf.service.impl; package jnpf.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jnpf.entity.*; import jnpf.entity.*;
import jnpf.mapper.YysMonthlyProductionMapper; import jnpf.mapper.YysMonthlyProductionMapper;
import jnpf.service.*; import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysmonthlyproduction.*; import jnpf.model.yysmonthlyproduction.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil; 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 java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel; import jnpf.model.QueryModel;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel; import jnpf.base.model.ColumnDataModel;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel; import jnpf.database.model.superQuery.SuperJsonModel;
@ -25,13 +25,14 @@ 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 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;
/** /**
*
* yysMonthlyProduction * yysMonthlyProduction
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
@ -48,9 +49,22 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
@Override @Override
public List<YysMonthlyProductionEntity> getList(YysMonthlyProductionPagination yysMonthlyProductionPagination) { public List<YysMonthlyProductionEntity> getList(YysMonthlyProductionPagination yysMonthlyProductionPagination) {
// QueryWrapper<YysMonthlyProductionEntity> wrapper = new QueryWrapper<>();
// if (ObjectUtil.isNotEmpty(yysMonthlyProductionPagination.getYears())) {
// wrapper.lambda().eq(YysMonthlyProductionEntity::getYears, yysMonthlyProductionPagination.getYears().toString());
// }
// wrapper.lambda().isNull(YysMonthlyProductionEntity::getDeleteMark);
// wrapper.last("ORDER BY CAST(day AS UNSIGNED)");
// Page<YysMonthlyProductionEntity> page = new Page<>(yysMonthlyProductionPagination.getCurrentPage(), yysMonthlyProductionPagination.getPageSize());
// IPage<YysMonthlyProductionEntity> userIPage = this.page(page, wrapper);
// return yysMonthlyProductionPagination.setData(userIPage.getRecords(), userIPage.getTotal());
return getTypeList(yysMonthlyProductionPagination, yysMonthlyProductionPagination.getDataType()); return getTypeList(yysMonthlyProductionPagination, yysMonthlyProductionPagination.getDataType());
} }
/** 列表查询 */
/**
*
*/
@Override @Override
public List<YysMonthlyProductionEntity> getTypeList(YysMonthlyProductionPagination yysMonthlyProductionPagination, String dataType) { public List<YysMonthlyProductionEntity> getTypeList(YysMonthlyProductionPagination yysMonthlyProductionPagination, String dataType) {
String userId = userProvider.get().getUserId(); String userId = userProvider.get().getUserId();
@ -219,27 +233,34 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
return this.list(yysMonthlyProductionQueryWrapper); return this.list(yysMonthlyProductionQueryWrapper);
} }
} }
@Override @Override
public YysMonthlyProductionEntity getInfo(String id) { public YysMonthlyProductionEntity getInfo(String id) {
QueryWrapper<YysMonthlyProductionEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<YysMonthlyProductionEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(YysMonthlyProductionEntity::getId, id); queryWrapper.lambda().eq(YysMonthlyProductionEntity::getId, id);
return this.getOne(queryWrapper); return this.getOne(queryWrapper);
} }
@Override @Override
public void create(YysMonthlyProductionEntity entity) { public void create(YysMonthlyProductionEntity entity) {
this.save(entity); this.save(entity);
} }
@Override @Override
public boolean update(String id, YysMonthlyProductionEntity entity) { public boolean update(String id, YysMonthlyProductionEntity entity) {
return this.updateById(entity); return this.updateById(entity);
} }
@Override @Override
public void delete(YysMonthlyProductionEntity entity) { public void delete(YysMonthlyProductionEntity 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(YysMonthlyProductionForm form, int i) { public String checkForm(YysMonthlyProductionForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0"); boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
@ -266,27 +287,52 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
} }
return countRecover; return countRecover;
} }
/** /**
* () * ()
*
* @param id * @param id
* @param yysMonthlyProductionForm * @param yysMonthlyProductionForm
* @return * @return
*/ */
@Override @Override
@Transactional @Transactional
public void saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm,String id, boolean isSave) throws Exception{ public String saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm, String id, boolean isSave) {
UserInfo userInfo = userProvider.get(); UserInfo userInfo = userProvider.get();
LambdaQueryWrapper<YysMonthlyProductionEntity> wrapper = new LambdaQueryWrapper<>(YysMonthlyProductionEntity.class);
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId()); UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysMonthlyProductionForm = JsonUtil.getJsonToBean( yysMonthlyProductionForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysMonthlyProductionConstant.getFormData(), yysMonthlyProductionForm), YysMonthlyProductionForm.class); generaterSwapUtil.swapDatetime(YysMonthlyProductionConstant.getFormData(), yysMonthlyProductionForm), YysMonthlyProductionForm.class);
YysMonthlyProductionEntity entity = JsonUtil.getJsonToBean(yysMonthlyProductionForm, YysMonthlyProductionEntity.class); YysMonthlyProductionEntity entity = JsonUtil.getJsonToBean(yysMonthlyProductionForm, YysMonthlyProductionEntity.class);
if (isSave) { if (isSave) {
wrapper.eq(YysMonthlyProductionEntity::getYears, yysMonthlyProductionForm.getYears());
wrapper.eq(YysMonthlyProductionEntity::getProductName, yysMonthlyProductionForm.getProductName());
if (CollectionUtils.isNotEmpty(this.list(wrapper))) {
return "所选年月与产品已被创建";
}
String mainId = RandomUtil.uuId(); String mainId = RandomUtil.uuId();
entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userInfo.getUserId());
entity.setId(mainId); entity.setId(mainId);
} else { } else {
wrapper.ne(YysMonthlyProductionEntity::getYears, yysMonthlyProductionForm.getYears());
wrapper.ne(YysMonthlyProductionEntity::getProductName, yysMonthlyProductionForm.getProductName());
if (CollectionUtils.isNotEmpty(this.list(wrapper))) {
return "所选年月与产品已被创建";
}
entity.setLastModifyTime(DateUtil.getNowDate());
entity.setLastModifyUserId(userInfo.getUserId());
}
boolean result = this.saveOrUpdate(entity);
if (result) {
return "操作成功";
} }
this.saveOrUpdate(entity); return "操作失败";
} }
} }

@ -117,12 +117,7 @@ public class YysMonthlyProductionController {
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b ); return ActionResult.fail(b );
} }
try{ return ActionResult.success(yysMonthlyProductionService.saveOrUpdate(yysMonthlyProductionForm, null, true));
yysMonthlyProductionService.saveOrUpdate(yysMonthlyProductionForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
} }
/** /**
* Excel * Excel

@ -346,6 +346,7 @@ export default {
// //
initDefaultData() { initDefaultData() {
this.dataForm.deliveryTime = new Date().getTime() this.dataForm.deliveryTime = new Date().getTime()
this.dataForm.years = new Date().getTime()
}, },
// //

Loading…
Cancel
Save