master
zengchenxi 3 months ago
parent d98fbb681b
commit 5f03fabb38

@ -4,7 +4,6 @@ import jnpf.model.yysmonthlyproduction.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* yysMonthlyProduction
@ -30,6 +29,6 @@ public interface YysMonthlyProductionService extends IService<YysMonthlyProducti
//副表数据方法
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;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jnpf.entity.*;
import jnpf.mapper.YysMonthlyProductionMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysmonthlyproduction.*;
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 +25,14 @@ 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;
/**
*
* yysMonthlyProduction
* V3.5
* https://www.jnpfsoft.com
@ -48,9 +49,22 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
@Override
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());
}
/** 列表查询 */
/**
*
*/
@Override
public List<YysMonthlyProductionEntity> getTypeList(YysMonthlyProductionPagination yysMonthlyProductionPagination, String dataType) {
String userId = userProvider.get().getUserId();
@ -219,27 +233,34 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
return this.list(yysMonthlyProductionQueryWrapper);
}
}
@Override
public YysMonthlyProductionEntity getInfo(String id) {
QueryWrapper<YysMonthlyProductionEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(YysMonthlyProductionEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(YysMonthlyProductionEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, YysMonthlyProductionEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(YysMonthlyProductionEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override
public String checkForm(YysMonthlyProductionForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
@ -266,27 +287,52 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
}
return countRecover;
}
/**
* ()
*
* @param id
* @param yysMonthlyProductionForm
* @return
*/
@Override
@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();
LambdaQueryWrapper<YysMonthlyProductionEntity> wrapper = new LambdaQueryWrapper<>(YysMonthlyProductionEntity.class);
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysMonthlyProductionForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysMonthlyProductionConstant.getFormData(), yysMonthlyProductionForm), YysMonthlyProductionForm.class);
YysMonthlyProductionEntity entity = JsonUtil.getJsonToBean(yysMonthlyProductionForm, YysMonthlyProductionEntity.class);
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();
entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userInfo.getUserId());
entity.setId(mainId);
} 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)){
return ActionResult.fail(b );
}
try{
yysMonthlyProductionService.saveOrUpdate(yysMonthlyProductionForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
return ActionResult.success(yysMonthlyProductionService.saveOrUpdate(yysMonthlyProductionForm, null, true));
}
/**
* Excel

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

Loading…
Cancel
Save