feat(打印):客户打印规则维护
This commit is contained in:
parent
0e7a100967
commit
4459b59405
@ -0,0 +1,31 @@
|
||||
package com.foreverwin.nlv.print.dto;
|
||||
|
||||
import com.foreverwin.nlv.print.entity.PrintRule;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class PrintRuleDTO extends PrintRule {
|
||||
|
||||
private String printRuleBo;
|
||||
|
||||
/**
|
||||
* 标签类别
|
||||
*/
|
||||
@ApiModelProperty(value="标签类别")
|
||||
private String labelCategory;
|
||||
|
||||
/**
|
||||
* 标签编号
|
||||
*/
|
||||
@ApiModelProperty(value="标签编号")
|
||||
private String templateCode;
|
||||
|
||||
/**
|
||||
* 打印份数
|
||||
*/
|
||||
@ApiModelProperty(value="打印份数")
|
||||
private BigDecimal printPages;
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.foreverwin.nlv.print.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 打印份数
|
||||
*
|
||||
* @author synnga
|
||||
* @date 2024-11-22 16:03:05
|
||||
*/
|
||||
@Data
|
||||
@TableName("print_pages")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "打印份数")
|
||||
public class PrintPages extends Model<PrintPages> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static final String KW_PRINT_PAGES_BO = "PrintPagesBO";
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="主键")
|
||||
private String handle;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
@ApiModelProperty(value="工厂")
|
||||
private String site;
|
||||
|
||||
/**
|
||||
* 关联打印规则
|
||||
*/
|
||||
@ApiModelProperty(value="关联打印规则")
|
||||
private String printRuleBo;
|
||||
|
||||
/**
|
||||
* 标签类别
|
||||
*/
|
||||
@ApiModelProperty(value="标签类别")
|
||||
private String labelCategory;
|
||||
|
||||
/**
|
||||
* 标签编号
|
||||
*/
|
||||
@ApiModelProperty(value="标签编号")
|
||||
private String templateCode;
|
||||
|
||||
/**
|
||||
* 打印份数
|
||||
*/
|
||||
@ApiModelProperty(value="打印份数")
|
||||
private BigDecimal printPages;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value="创建人")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 更新人员
|
||||
*/
|
||||
@ApiModelProperty(value="更新人员")
|
||||
private String updater;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value="创建时间")
|
||||
private LocalDateTime dateCreate;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value="更新时间")
|
||||
private LocalDateTime dateUpdate;
|
||||
|
||||
|
||||
}
|
||||
@ -9,6 +9,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ -43,35 +44,10 @@ public class PrintRule extends Model<PrintRule> {
|
||||
@TableField("STATUS")
|
||||
private String status;
|
||||
/**
|
||||
* 规则公式1
|
||||
* 车间代码
|
||||
*/
|
||||
@TableField("RULE1")
|
||||
private String rule1;
|
||||
/**
|
||||
* 规则公式1打印次数
|
||||
*/
|
||||
@TableField("PRINT_NUMBER1")
|
||||
private String printNumber1;
|
||||
/**
|
||||
* 规则公式2
|
||||
*/
|
||||
@TableField("RULE2")
|
||||
private String rule2;
|
||||
/**
|
||||
* 规则公式2打印次数
|
||||
*/
|
||||
@TableField("PRINT_NUMBER2")
|
||||
private String printNumber2;
|
||||
/**
|
||||
* 规则公式3
|
||||
*/
|
||||
@TableField("RULE3")
|
||||
private String rule3;
|
||||
/**
|
||||
* 规则公式3打印次数
|
||||
*/
|
||||
@TableField("PRINT_NUMBER3")
|
||||
private String printNumber3;
|
||||
@TableField("FAB_NO")
|
||||
private String fabNo;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ -82,5 +58,8 @@ public class PrintRule extends Model<PrintRule> {
|
||||
*/
|
||||
@TableField("CREATED_USER")
|
||||
private String createdUser;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<PrintPages> printPageList;
|
||||
|
||||
}
|
||||
@ -1,11 +1,20 @@
|
||||
package com.foreverwin.nlv.print.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.nlv.print.dto.PrintRuleDTO;
|
||||
import com.foreverwin.nlv.print.entity.PrintRule;
|
||||
import com.foreverwin.nlv.print.service.CustomerPrintRuleService;
|
||||
import com.foreverwin.nlv.print.service.PrintRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -20,16 +29,19 @@ public class CustomerPrintRuleController {
|
||||
|
||||
@Autowired
|
||||
public CustomerPrintRuleService customerPrintRuleService;
|
||||
|
||||
@Autowired
|
||||
PrintRuleService printRuleService;
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping("/search")
|
||||
public R getPrintRuleList(PrintRule printRule){
|
||||
QueryWrapper<PrintRule> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(printRule);
|
||||
return R.ok(customerPrintRuleService.list(queryWrapper));
|
||||
public R getPrintRuleList(PrintRuleDTO dto){
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
return R.ok(printRuleService.selectWithPageList(site, dto));
|
||||
}
|
||||
/**
|
||||
* 保存
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
package com.foreverwin.nlv.print.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.log.annotation.SysLog;
|
||||
import com.foreverwin.nlv.print.entity.PrintPages;
|
||||
import com.foreverwin.nlv.print.service.PrintPagesService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.foreverwin.mom.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 打印份数
|
||||
*
|
||||
* @author synnga
|
||||
* @date 2024-11-22 16:03:05
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/print-pages" )
|
||||
@Api(value = "print-pages", tags = "打印份数管理")
|
||||
public class PrintPagesController {
|
||||
|
||||
private final PrintPagesService printPagesService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param printPages 打印份数
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('print_pages_view')" )
|
||||
public R getPrintPagesPage(FrontPage page, PrintPages printPages) {
|
||||
printPages.setSite(TenantContextHolder.getTenantId());
|
||||
LambdaQueryWrapper<PrintPages> queryWrapper = Wrappers.lambdaQuery();
|
||||
if (StrUtil.isNotBlank(page.getSearchText())) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.like(PrintPages::getPrintRuleBo, page.getSearchText())
|
||||
.or().like(PrintPages::getLabelCategory, page.getSearchText())
|
||||
.or().like(PrintPages::getTemplateCode, page.getSearchText())
|
||||
.or().like(PrintPages::getCreator, page.getSearchText())
|
||||
.or().like(PrintPages::getUpdater, page.getSearchText())
|
||||
);
|
||||
}
|
||||
return R.ok(printPagesService.page(page.genOrders(), queryWrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询打印份数
|
||||
* @param handle id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/{handle}" )
|
||||
@PreAuthorize("@pms.hasPermission('print_pages_view')" )
|
||||
public R getById(@PathVariable("handle" ) String handle) {
|
||||
return R.ok(printPagesService.getById(handle));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增打印份数
|
||||
* @param printPages 打印份数
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增打印份数", notes = "新增打印份数")
|
||||
@SysLog("新增打印份数" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('print_pages_save')" )
|
||||
public R save(@RequestBody PrintPages printPages) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
return R.ok(printPagesService.save(site, user, printPages));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改打印份数
|
||||
* @param printPages 打印份数
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改打印份数", notes = "修改打印份数")
|
||||
@SysLog("修改打印份数" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('print_pages_save')" )
|
||||
public R updateById(@RequestBody PrintPages printPages) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
return R.ok(printPagesService.updateById(site, user, printPages));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除打印份数
|
||||
* @param handle id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除打印份数", notes = "通过id删除打印份数")
|
||||
@SysLog("通过id删除打印份数" )
|
||||
@DeleteMapping("/{handle}" )
|
||||
@PreAuthorize("@pms.hasPermission('print_pages_del')" )
|
||||
public R removeById(@PathVariable String handle) {
|
||||
return R.ok(printPagesService.removeById(handle));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param printPages 查询条件
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('print_pages_export')" )
|
||||
public List<PrintPages> export(PrintPages printPages) {
|
||||
return printPagesService.list(Wrappers.query(printPages));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.foreverwin.nlv.print.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.nlv.print.entity.PrintPages;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 打印份数
|
||||
*
|
||||
* @author synnga
|
||||
* @date 2024-11-22 16:03:05
|
||||
*/
|
||||
public interface PrintPagesService extends IService<PrintPages> {
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
boolean save(String site, String creator, PrintPages printPages);
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
boolean updateById(String site, String updater, PrintPages printPages);
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.foreverwin.nlv.print.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.nlv.print.dto.PrintRuleDTO;
|
||||
import com.foreverwin.nlv.print.entity.PrintRule;
|
||||
|
||||
import java.util.List;
|
||||
@ -15,4 +16,6 @@ public interface PrintRuleService extends IService<PrintRule> {
|
||||
void doDelete(List<PrintRule> printRuleList);
|
||||
|
||||
List<Map<String,String>> getLabelCategoryList(String site);
|
||||
|
||||
List<PrintRule> selectWithPageList(String site, PrintRuleDTO dto);
|
||||
}
|
||||
@ -1,10 +1,15 @@
|
||||
package com.foreverwin.nlv.print.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.nlv.print.entity.PrintPages;
|
||||
import com.foreverwin.nlv.print.entity.PrintRule;
|
||||
import com.foreverwin.nlv.print.mapper.CustomerPrintRuleMapper;
|
||||
import com.foreverwin.nlv.print.service.CustomerPrintRuleService;
|
||||
import com.foreverwin.nlv.print.service.PrintPagesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -19,6 +24,9 @@ public class CustomerCustomerPrintRuleServiceImpl extends ServiceImpl<CustomerPr
|
||||
|
||||
@Autowired
|
||||
private CustomerPrintRuleMapper customerPrintRuleMapper;
|
||||
|
||||
@Autowired
|
||||
private PrintPagesService printPagesService;
|
||||
|
||||
@Override
|
||||
public List<PrintRule> selectList(PrintRule printRule) {
|
||||
@ -29,6 +37,7 @@ public class CustomerCustomerPrintRuleServiceImpl extends ServiceImpl<CustomerPr
|
||||
|
||||
@Override
|
||||
public void doSave(List<PrintRule> printRuleList) {
|
||||
String user = SecurityUtils.getUserName();
|
||||
LocalDateTime time = LocalDateTime.now();
|
||||
for(PrintRule printRule: printRuleList){
|
||||
PrintRule message = new PrintRule();
|
||||
@ -36,8 +45,21 @@ public class CustomerCustomerPrintRuleServiceImpl extends ServiceImpl<CustomerPr
|
||||
QueryWrapper<PrintRule> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(message);
|
||||
super.remove(queryWrapper);
|
||||
|
||||
printPagesService.remove(Wrappers.<PrintPages>lambdaQuery().eq(PrintPages::getPrintRuleBo, printRule.getHandle()));
|
||||
printRule.setCreatedDateTime(time);
|
||||
List<PrintPages> printPageList = printRule.getPrintPageList();
|
||||
if(printPageList != null && !printPageList.isEmpty()) {
|
||||
for(PrintPages printPages: printPageList) {
|
||||
printPages.setHandle(StrUtil.uuid());
|
||||
printPages.setPrintRuleBo(printRule.getHandle());
|
||||
printPages.setSite(printRule.getSite());
|
||||
printPages.setCreator(user);
|
||||
printPages.setUpdater(user);
|
||||
printPages.setDateCreate(time);
|
||||
printPages.setDateUpdate(time);
|
||||
}
|
||||
printPagesService.saveBatch(printPageList);
|
||||
}
|
||||
super.save(printRule);
|
||||
}
|
||||
}
|
||||
@ -47,6 +69,7 @@ public class CustomerCustomerPrintRuleServiceImpl extends ServiceImpl<CustomerPr
|
||||
for(PrintRule printRule: printRuleList){
|
||||
QueryWrapper<PrintRule> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(printRule);
|
||||
printPagesService.remove(Wrappers.<PrintPages>lambdaQuery().eq(PrintPages::getPrintRuleBo, printRule.getHandle()));
|
||||
super.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
package com.foreverwin.nlv.print.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.nlv.print.entity.PrintPages;
|
||||
import com.foreverwin.nlv.print.mapper.PrintPagesMapper;
|
||||
import com.foreverwin.nlv.print.service.PrintPagesService;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.core.util.I18nUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 打印份数
|
||||
*
|
||||
* @author synnga
|
||||
* @date 2024-11-22 16:03:05
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class PrintPagesServiceImpl extends ServiceImpl<PrintPagesMapper, PrintPages> implements PrintPagesService {
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean save(String site, String creator, PrintPages printPages) {
|
||||
printPages.setSite(site);
|
||||
printPages.setCreator(creator);
|
||||
printPages.setDateCreate(LocalDateTime.now());
|
||||
// TODO 生成handle printPages.setHandle(handle);
|
||||
try {
|
||||
return super.save(printPages);
|
||||
} catch (Exception e) {
|
||||
if(e instanceof SQLIntegrityConstraintViolationException || e instanceof DuplicateKeyException) {
|
||||
throw new MybatisPlusException(I18nUtil.getI18nText("iep.error225", e.getCause().getLocalizedMessage()));
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean updateById(String site, String updater, PrintPages printPages) {
|
||||
|
||||
String handle = printPages.getHandle();
|
||||
if(StrUtil.isBlank(handle)) {
|
||||
throw BusinessException.build(I18nUtil.getI18nText("iep.error226"));
|
||||
}
|
||||
printPages.setUpdater(updater);
|
||||
printPages.setDateUpdate(LocalDateTime.now());
|
||||
return super.updateById(printPages);
|
||||
}
|
||||
}
|
||||
@ -1,58 +1,94 @@
|
||||
package com.foreverwin.nlv.print.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.nlv.print.dto.PrintRuleDTO;
|
||||
import com.foreverwin.nlv.print.entity.PrintPages;
|
||||
import com.foreverwin.nlv.print.entity.PrintRule;
|
||||
import com.foreverwin.nlv.print.mapper.PrintRuleMapper;
|
||||
import com.foreverwin.nlv.print.service.PrintRuleService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class PrintRuleServiceImpl extends ServiceImpl<PrintRuleMapper, PrintRule> implements PrintRuleService {
|
||||
|
||||
@Autowired
|
||||
private PrintRuleMapper printRuleMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private PrintRuleMapper printRuleMapper;
|
||||
|
||||
@Override
|
||||
public List<PrintRule> selectList(PrintRule printRule) {
|
||||
QueryWrapper<PrintRule> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(printRule);
|
||||
return super.list(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doSave(List<PrintRule> printRuleList) {
|
||||
LocalDateTime time = LocalDateTime.now();
|
||||
for(PrintRule printRule: printRuleList){
|
||||
for (PrintRule printRule : printRuleList) {
|
||||
PrintRule message = new PrintRule();
|
||||
message.setHandle(printRule.getHandle());
|
||||
QueryWrapper<PrintRule> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(message);
|
||||
super.remove(queryWrapper);
|
||||
|
||||
|
||||
printRule.setCreatedDateTime(time);
|
||||
super.save(printRule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doDelete(List<PrintRule> printRuleList) {
|
||||
for(PrintRule printRule: printRuleList){
|
||||
for (PrintRule printRule : printRuleList) {
|
||||
QueryWrapper<PrintRule> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(printRule);
|
||||
super.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> getLabelCategoryList(String site) {
|
||||
return printRuleMapper.selectLabelCategory(site);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> getLabelCategoryList(String site) {
|
||||
return printRuleMapper.selectLabelCategory(site);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrintRule> selectWithPageList(String site, PrintRuleDTO dto) {
|
||||
List<PrintRule> printRuleList = new ArrayList<>();
|
||||
List<PrintRuleDTO> resultList = printRuleMapper.selectFull(site, dto);
|
||||
if (resultList != null && resultList.size() > 0) {
|
||||
// 将labelCategory, templateCode, printPages栏位按照handle进行分组
|
||||
Map<String, List<PrintRuleDTO>> map = resultList.stream()
|
||||
.collect(Collectors.groupingBy(PrintRuleDTO::getHandle));
|
||||
for (Map.Entry<String, List<PrintRuleDTO>> entry : map.entrySet()) {
|
||||
String handle = entry.getKey();
|
||||
List<PrintRuleDTO> printRuleDTOList = entry.getValue();
|
||||
PrintRule printRule = new PrintRule();
|
||||
BeanUtils.copyProperties(printRuleDTOList.get(0), printRule);
|
||||
List<PrintPages> printPagesList = new ArrayList<>();
|
||||
for(PrintRuleDTO printRuleDTO : printRuleDTOList) {
|
||||
if(StrUtil.isNotEmpty(printRuleDTO.getPrintRuleBo())) {
|
||||
PrintPages printPages = new PrintPages();
|
||||
BeanUtils.copyProperties(printRuleDTO, printPages);
|
||||
printPages.setLabelCategory(printRuleDTO.getLabelCategory() == null ? "" : printRuleDTO.getLabelCategory());
|
||||
printPages.setTemplateCode(printRuleDTO.getTemplateCode() == null ? "" : printRuleDTO.getTemplateCode());
|
||||
printPagesList.add(printPages);
|
||||
}
|
||||
}
|
||||
printRule.setPrintPageList(printPagesList);
|
||||
printRuleList.add(printRule);
|
||||
}
|
||||
}
|
||||
return printRuleList;
|
||||
}
|
||||
}
|
||||
@ -344,7 +344,7 @@ public class PrintServiceImpl implements PrintService {
|
||||
}
|
||||
}
|
||||
|
||||
for (PrintRule pr : printRules) {
|
||||
/*for (PrintRule pr : printRules) {
|
||||
if (!StringUtil.isEmpty(pr.getRule1())) {
|
||||
Map m1 = new HashMap();
|
||||
m1.put("rule", pr.getRule1());
|
||||
@ -363,7 +363,7 @@ public class PrintServiceImpl implements PrintService {
|
||||
m3.put("printCount", pr.getPrintNumber3());
|
||||
rulePrintCntMapList.add(m3);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//依客户编号、规则公式(模板类别)及打印次数 更新最终使用的打印模板及打印次数
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.foreverwin.nlv.print.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.foreverwin.nlv.print.entity.PrintPages;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 打印份数
|
||||
*
|
||||
* @author synnga
|
||||
* @date 2024-11-22 16:03:05
|
||||
*/
|
||||
@Mapper
|
||||
public interface PrintPagesMapper extends BaseMapper<PrintPages> {
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.foreverwin.nlv.print.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.foreverwin.nlv.print.dto.PrintRuleDTO;
|
||||
import com.foreverwin.nlv.print.entity.PrintRule;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -13,4 +14,6 @@ import java.util.Map;
|
||||
@Mapper
|
||||
public interface PrintRuleMapper extends BaseMapper<PrintRule> {
|
||||
List<Map<String,String>> selectLabelCategory(@Param("site") String site);
|
||||
|
||||
List<PrintRuleDTO> selectFull(@Param("site") String site, @Param("dto") PrintRuleDTO dto);
|
||||
}
|
||||
@ -9,12 +9,7 @@
|
||||
<result column="CUSTOMER_CODE" property="customerCode" />
|
||||
<result column="OPERATION" property="operation" />
|
||||
<result column="STATUS" property="status" />
|
||||
<result column="RULE1" property="rule1" />
|
||||
<result column="PRINT_NUMBER1" property="printNumber1" />
|
||||
<result column="RULE2" property="rule2" />
|
||||
<result column="PRINT_NUMBER2" property="printNumber2" />
|
||||
<result column="RULE3" property="rule3" />
|
||||
<result column="PRINT_NUMBER3" property="printNumber3" />
|
||||
<result column="FAB_NO" property="fabNo" />
|
||||
<result column="CREATED_DATE_TIME" property="createdDateTime" />
|
||||
<result column="CREATED_USER" property="createdUser" />
|
||||
</resultMap>
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.foreverwin.nlv.print.mapper.PrintPagesMapper">
|
||||
|
||||
<resultMap id="printPagesMap" type="com.foreverwin.nlv.print.entity.PrintPages">
|
||||
<id property="handle" column="HANDLE"/>
|
||||
<result property="site" column="SITE"/>
|
||||
<result property="printRuleBo" column="PRINT_RULE_BO"/>
|
||||
<result property="labelCategory" column="LABEL_CATEGORY"/>
|
||||
<result property="templateCode" column="TEMPLATE_CODE"/>
|
||||
<result property="printPages" column="PRINT_PAGES"/>
|
||||
<result property="creator" column="CREATOR"/>
|
||||
<result property="updater" column="UPDATER"/>
|
||||
<result property="dateCreate" column="DATE_CREATE"/>
|
||||
<result property="dateUpdate" column="DATE_UPDATE"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@ -9,22 +9,34 @@
|
||||
<result column="CUSTOMER_CODE" property="customerCode" />
|
||||
<result column="OPERATION" property="operation" />
|
||||
<result column="STATUS" property="status" />
|
||||
<result column="RULE1" property="rule1" />
|
||||
<result column="PRINT_NUMBER1" property="printNumber1" />
|
||||
<result column="RULE2" property="rule2" />
|
||||
<result column="PRINT_NUMBER2" property="printNumber2" />
|
||||
<result column="RULE3" property="rule3" />
|
||||
<result column="PRINT_NUMBER3" property="printNumber3" />
|
||||
<result column="FAB_NO" property="fabNo" />
|
||||
<result column="CREATED_DATE_TIME" property="createdDateTime" />
|
||||
<result column="CREATED_USER" property="createdUser" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
HANDLE, SITE, CUSTOMER_CODE, OPERATION, STATUS, RULE1, PRINT_NUMBER1, RULE2, PRINT_NUMBER2, RULE3, PRINT_NUMBER3, CREATED_DATE_TIME, CREATED_USER
|
||||
HANDLE, SITE, CUSTOMER_CODE, FAB_NO, OPERATION, STATUS, FAB_NO, CREATED_DATE_TIME, CREATED_USER
|
||||
</sql>
|
||||
<!-- 查询模板类别 -->
|
||||
<select id="selectLabelCategory" resultType="java.util.LinkedHashMap">
|
||||
SELECT LABEL_CATEGORY_ID,LABEL_CATEGORY_NAME FROM Z_LABELCATEGORY WHERE SITE=#{site}
|
||||
SELECT LABEL_CATEGORY_ID,LABEL_CATEGORY_NAME FROM PRINT_LABEL_CATEGORY WHERE SITE=#{site}
|
||||
</select>
|
||||
|
||||
<select id="selectFull" resultType="com.foreverwin.nlv.print.dto.PrintRuleDTO">
|
||||
SELECT *
|
||||
FROM PRINT_RULE PR
|
||||
LEFT JOIN print_pages pp
|
||||
ON PP.PRINT_RULE_BO = PR.HANDLE
|
||||
WHERE PR.SITE = #{site}
|
||||
<if test="dto.customerCode != null and dto.customerCode != ''">
|
||||
AND PR.CUSTOMER_CODE = #{dto.customerCode}
|
||||
</if>
|
||||
<if test="dto.fabNo != null and dto.fabNo != ''">
|
||||
AND PR.FAB_NO = #{dto.fabNo}
|
||||
</if>
|
||||
<if test="dto.operation != null and dto.operation != ''">
|
||||
AND PR.OPERATION = #{dto.operation}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user