Merge remote-tracking branch 'remotes/origin/dev' into test
# Conflicts: # modules/i3plus-ics-gateway/src/main/resources/application-test.properties # modules/i3plus-ics-regist/i3plus-ics-regist.iml 返回提示修改 报表打印修改yun-zuoyi
commit
9026617500
@ -0,0 +1,72 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysBarcodeRule;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 条码规则服务
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2019-03-12 16:01
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public interface ISysBarcodeRuleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加条码规则
|
||||||
|
* @param barcodeRule
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增条码规则信息")
|
||||||
|
SysBarcodeRule insertSysBarcodeRule(SysBarcodeRule barcodeRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改条码规则
|
||||||
|
* @param barcodeRule
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "更新条码规则信息")
|
||||||
|
void updateSysBarcodeRule(SysBarcodeRule barcodeRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查找全部条码规则
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询所有条码规则信息",notes = "查询所有条码规则信息")
|
||||||
|
List<SysBarcodeRule> listSysBarcodeRule();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查找条码规则
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询条码规则信息",notes = "根据ID查询条码规则信息")
|
||||||
|
SysBarcodeRule getSysBarcodeRuleById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除条码规则
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据id删除条码规则",notes = "根据id删除条码规则")
|
||||||
|
void deleteSysBarcodeRuleById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据规则代码查询条码规则
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据规则代码查询条码规则",notes = "根据规则代码查询条码规则")
|
||||||
|
SysBarcodeRule getSysBarcodeRuleByCode(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条码规则复杂查询分页排序
|
||||||
|
* @param barcodeRule
|
||||||
|
* @param pager
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据规则代码查询条码规则",notes = "根据规则代码查询条码规则")
|
||||||
|
ListPager<SysBarcodeRule> querySysBarcodeRuleByPager(SysBarcodeRule barcodeRule, Pager pager);
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.model.platform.LabelTemplateModel;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLabelTemplate;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLabelTemplateParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 打印模板服务接口
|
||||||
|
* @Reference :
|
||||||
|
* @Author : siliter
|
||||||
|
* @Date : 2019-03-18 9:25
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
public interface ISysLabelTemplateService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加打印模板
|
||||||
|
* @param sysLabelTemplate
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "添加打印模板")
|
||||||
|
void insertSysLabelTemplate(SysLabelTemplate sysLabelTemplate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除打印模板
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除打印模板")
|
||||||
|
void deleteSysLabelTemplateById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改打印模板
|
||||||
|
* @param sysLabelTemplate
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改打印模板")
|
||||||
|
void updateSysLabelTemplate(SysLabelTemplate sysLabelTemplate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部打印模板
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询全部打印模板")
|
||||||
|
List<SysLabelTemplate> ListSysLabelTemplate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询打印模板
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据id查询打印模板")
|
||||||
|
SysLabelTemplate getSysLabelTemplateById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印模板复杂查询分页排序
|
||||||
|
* @param sysLabelTemplate
|
||||||
|
* @param pager
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "打印模板复杂查询分页排序")
|
||||||
|
ListPager querySysLabelTemplateByPager(SysLabelTemplate sysLabelTemplate, Pager pager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板编号查询模板参数
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据模板编号查询模板参数")
|
||||||
|
List<SysLabelTemplateParam> listSysLabelTemplateParam(String labelTemplateId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板编号查询模板信息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "根据模板编号查询模板信息")
|
||||||
|
LabelTemplateModel getLabelTemplateInfoById(String labelTemplateId);
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysBarcodeRuleService;
|
||||||
|
import cn.estsh.i3plus.core.apiservice.util.BarcodeParseUtil;
|
||||||
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysBarcodeRule;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysConfig;
|
||||||
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
||||||
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :条码规则管理服务
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2019-03-12 16:00
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@Api(description = "条码规则管理服务")
|
||||||
|
@RequestMapping(PlatformConstWords.BASE_URL +"/sys-barcode-rule")
|
||||||
|
public class SysBarcodeRuleController extends CoreBaseController {
|
||||||
|
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysConfigController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysBarcodeRuleService sysBarcodeRuleService;
|
||||||
|
|
||||||
|
@PostMapping("/insert")
|
||||||
|
@ApiOperation(value = "添加条码规则",notes = "添加条码规则")
|
||||||
|
public ResultBean insertSysBarcodeRule(SysBarcodeRule sysBarcodeRule) {
|
||||||
|
try {
|
||||||
|
// 条件验证
|
||||||
|
ValidatorBean.beginValid(sysBarcodeRule)
|
||||||
|
.notNull("name",sysBarcodeRule.getName())
|
||||||
|
.notNull("barcodeRuleCode",sysBarcodeRule.getBarcodeRuleCode())
|
||||||
|
.notNull("barcodeRule",sysBarcodeRule.getBarcodeRule());
|
||||||
|
|
||||||
|
sysBarcodeRuleService.insertSysBarcodeRule(sysBarcodeRule);
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation(value = "修改条码规则",notes = "修改条码规则")
|
||||||
|
public ResultBean updateSysBarcodeRule(SysBarcodeRule sysBarcodeRule) {
|
||||||
|
try {
|
||||||
|
// 条件验证
|
||||||
|
ValidatorBean.beginValid(sysBarcodeRule)
|
||||||
|
.notNull("name",sysBarcodeRule.getName())
|
||||||
|
.notNull("barcodeRuleCode",sysBarcodeRule.getBarcodeRuleCode())
|
||||||
|
.notNull("barcodeRule",sysBarcodeRule.getBarcodeRule());
|
||||||
|
|
||||||
|
sysBarcodeRuleService.updateSysBarcodeRule(sysBarcodeRule);
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete/{id}")
|
||||||
|
@ApiOperation(value = "删除条码规则",notes = "删除条码规则")
|
||||||
|
public ResultBean deleteSysBarcodeRuleById(@PathVariable("id") String idStr) {
|
||||||
|
try {
|
||||||
|
// 条件验证
|
||||||
|
ValidatorBean.checkNotNull(idStr,"id不能为空");
|
||||||
|
SysBarcodeRule sysBarcodeRule = sysBarcodeRuleService.getSysBarcodeRuleById(Long.parseLong(idStr));
|
||||||
|
if(sysBarcodeRule == null){
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
||||||
|
.setErrorDetail("条码规则不存在")
|
||||||
|
.setErrorSolution("请重新输入条码id")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
sysBarcodeRuleService.deleteSysBarcodeRuleById(Long.parseLong(idStr));
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/query")
|
||||||
|
@ApiOperation(value = "条码规则分页复杂查询",notes = "条码规则分页复杂查询")
|
||||||
|
public ResultBean querySysBarcodeRuleByPager(SysBarcodeRule sysBarcodeRule, Pager pager) {
|
||||||
|
try {
|
||||||
|
ListPager listPager = sysBarcodeRuleService.querySysBarcodeRuleByPager(sysBarcodeRule,pager);
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setListPager(listPager);
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/parser")
|
||||||
|
@ApiOperation(value = "解析条码规则",notes = "解析条码规则")
|
||||||
|
public ResultBean querySysBarcodeRuleByPager(String ruleCode, String barcode) {
|
||||||
|
try {
|
||||||
|
// 条件验证
|
||||||
|
ValidatorBean.checkNotNull(ruleCode,"规则代码不能为空");
|
||||||
|
SysBarcodeRule sysBarcodeRule = sysBarcodeRuleService.getSysBarcodeRuleByCode(ruleCode);
|
||||||
|
if(sysBarcodeRule == null){
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
||||||
|
.setErrorDetail("条码规则不存在")
|
||||||
|
.setErrorSolution("请重新输入条码id")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析条码规则
|
||||||
|
Map resultMap = BarcodeParseUtil.parse(sysBarcodeRule,barcode);
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultMap(resultMap);
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,214 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysLabelTemplateService;
|
||||||
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.model.platform.LabelTemplateModel;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLabelTemplate;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLabelTemplateParam;
|
||||||
|
import cn.estsh.impp.framework.base.controller.CoreBaseController;
|
||||||
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||||
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 打印模板管理服务
|
||||||
|
* @Reference :
|
||||||
|
* @Author : siliter
|
||||||
|
* @Date : 2019-03-18 13:15
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@Api(description = "打印模板管理服务")
|
||||||
|
@RequestMapping(PlatformConstWords.BASE_URL +"/sys-label-template")
|
||||||
|
public class SysLabelTemplateController extends CoreBaseController {
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysLabelTemplateController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysLabelTemplateService sysLabelTemplateService;
|
||||||
|
|
||||||
|
@PostMapping("/insert")
|
||||||
|
@ApiOperation(value = "添加打印模板",notes = "添加打印模板")
|
||||||
|
public ResultBean insertSysLabelTemplate(SysLabelTemplate sysLabelTemplate) {
|
||||||
|
try {
|
||||||
|
// 登录用户
|
||||||
|
SessionUser user = AuthUtil.getSessionUser();
|
||||||
|
|
||||||
|
// 条件验证
|
||||||
|
ValidatorBean.beginValid(sysLabelTemplate)
|
||||||
|
.notNull("templateCode", sysLabelTemplate.getTemplateCode())
|
||||||
|
.notNull("templateName", sysLabelTemplate.getTemplateName())
|
||||||
|
.notNull("paramsPack", sysLabelTemplate.getParamsPack())
|
||||||
|
.notNull("templateContent", sysLabelTemplate.getTemplateContent());
|
||||||
|
|
||||||
|
//修改初始化
|
||||||
|
ConvertBean.modelInitialize(sysLabelTemplate, user);
|
||||||
|
|
||||||
|
sysLabelTemplateService.insertSysLabelTemplate(sysLabelTemplate);
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/delete/{id}")
|
||||||
|
@ApiOperation(value = "根据id删除打印模板", notes = "根据id删除打印模板")
|
||||||
|
public ResultBean deleteSysLabelTemplate(@PathVariable("id") String idStr) {
|
||||||
|
try {
|
||||||
|
// 条件验证
|
||||||
|
ValidatorBean.checkNotNull(idStr,"id不能为空");
|
||||||
|
if(sysLabelTemplateService.getSysLabelTemplateById(Long.parseLong(idStr)) == null){
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
||||||
|
.setErrorDetail("打印模板不存在")
|
||||||
|
.setErrorSolution("请检查打印模板编号")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
sysLabelTemplateService.deleteSysLabelTemplateById(Long.parseLong(idStr));
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping(value = "/update")
|
||||||
|
@ApiOperation(value = "修改打印模板",notes = "修改打印模板")
|
||||||
|
public ResultBean updateSysLabelTemplate(SysLabelTemplate sysLabelTemplate){
|
||||||
|
try {
|
||||||
|
// 登录用户
|
||||||
|
SessionUser user = AuthUtil.getSessionUser();
|
||||||
|
|
||||||
|
// 条件验证
|
||||||
|
ValidatorBean.beginValid(sysLabelTemplate)
|
||||||
|
.notNull("templateCode", sysLabelTemplate.getTemplateCode())
|
||||||
|
.notNull("templateName", sysLabelTemplate.getTemplateName())
|
||||||
|
.notNull("paramsPack", sysLabelTemplate.getParamsPack())
|
||||||
|
.notNull("templateContent", sysLabelTemplate.getTemplateContent());
|
||||||
|
|
||||||
|
//添加初始化
|
||||||
|
ConvertBean.modelUpdate(sysLabelTemplate, user);
|
||||||
|
|
||||||
|
sysLabelTemplateService.updateSysLabelTemplate(sysLabelTemplate);
|
||||||
|
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
@ApiOperation(value = "查询全部打印模板",notes = "查询全部打印模板")
|
||||||
|
public ResultBean findSysConfigAll(){
|
||||||
|
try {
|
||||||
|
List<SysLabelTemplate> sysLabelTemplateList = sysLabelTemplateService.ListSysLabelTemplate();
|
||||||
|
return ResultBean.success("操作成功")
|
||||||
|
.setResultList(sysLabelTemplateList)
|
||||||
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/get/{id}")
|
||||||
|
@ApiOperation(value = "根据id查询打印模板",notes = "根据id查询打印模板")
|
||||||
|
public ResultBean getSysLabelTemplateById(@PathVariable("id") String id){
|
||||||
|
try {
|
||||||
|
ValidatorBean.checkNotNull(id,"id不能为空");
|
||||||
|
|
||||||
|
SysLabelTemplate sysLabelTemplate = sysLabelTemplateService.getSysLabelTemplateById(Long.parseLong(id));
|
||||||
|
if (sysLabelTemplate != null) {
|
||||||
|
return ResultBean.success("操作成功")
|
||||||
|
.setResultObject(sysLabelTemplate).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}else {
|
||||||
|
return ResultBean.fail("数据不存在").setCode(ResourceEnumUtil.MESSAGE.EMPTY.getCode());
|
||||||
|
}
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/query")
|
||||||
|
@ApiOperation(value = "打印模板复杂查询,分页,排序",notes = "打印模板复杂查询,分页,排序")
|
||||||
|
public ResultBean querySysLabelTemplateByPager(SysLabelTemplate sysLabelTemplate,Pager pager) {
|
||||||
|
try {
|
||||||
|
ListPager sysConfigListPager = sysLabelTemplateService.querySysLabelTemplateByPager(sysLabelTemplate,pager);
|
||||||
|
return ResultBean.success("操作成功").setListPager(sysConfigListPager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/find-template-id/{id}")
|
||||||
|
@ApiOperation(value = "根据打印模板编号查询模板参数",notes = "根据打印模板编号查询模板参数")
|
||||||
|
public ResultBean getSysLabelTemplateByTemplateId(@PathVariable("id") String id) {
|
||||||
|
try {
|
||||||
|
if (StringUtils.isBlank(id)) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
||||||
|
.setErrorDetail("打印模板编号为空")
|
||||||
|
.setErrorSolution("请检查打印模板编号")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultBean.success("操作成功").setResultList(sysLabelTemplateService.listSysLabelTemplateParam(id))
|
||||||
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-template-info/{id}")
|
||||||
|
@ApiOperation(value = "根据打印模板编号查询模板",notes = "根据打印模板编号查询模板")
|
||||||
|
public ResultBean getSysLabelTemplateInfoById(@PathVariable("id") String id) {
|
||||||
|
try {
|
||||||
|
if (StringUtils.isBlank(id)) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorDetail("打印模板编号为空")
|
||||||
|
.setErrorSolution("请检查打印模板编号")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultBean.success("操作成功").setResultObject(sysLabelTemplateService.getLabelTemplateInfoById(id))
|
||||||
|
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||||
|
}catch(ImppBusiException busExcep){
|
||||||
|
return ResultBean.fail(busExcep);
|
||||||
|
}catch(Exception e){
|
||||||
|
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,31 +0,0 @@
|
|||||||
package cn.estsh.i3plus.core.apiservice.controller.busi;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description :
|
|
||||||
* @Reference :
|
|
||||||
* @Author : yunhao
|
|
||||||
* @CreateDate : 2019-02-19 18:13
|
|
||||||
* @Modify:
|
|
||||||
**/
|
|
||||||
public class TestThread implements Runnable {
|
|
||||||
|
|
||||||
private Thread t;
|
|
||||||
private int piLength = 0;
|
|
||||||
|
|
||||||
public TestThread (int piLength){
|
|
||||||
this.piLength = piLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ComputePi.computePi(piLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start () {
|
|
||||||
if (t == null) {
|
|
||||||
t = new Thread (this);
|
|
||||||
t.start ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.mq;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysMessageService;
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserService;
|
||||||
|
import cn.estsh.i3plus.core.apiservice.websocket.MessageWebSocket;
|
||||||
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
||||||
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||||
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserMessage;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysUser;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 站内信队列处理
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2018-11-15 22:35
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Component
|
||||||
|
@RabbitListener(queues = PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK)
|
||||||
|
public class MessageLetterQueueReceiverHandler {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(MessageLetterQueueReceiverHandler.class);
|
||||||
|
|
||||||
|
@RabbitHandler
|
||||||
|
public void handleMessage(byte[] message){
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(byte[] message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(byte[] message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(byte[] message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RabbitHandler
|
||||||
|
public void handleMessage(String message){
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(String message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(String message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(String message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RabbitHandler
|
||||||
|
public void handleMessage(SysMessage message){
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(SysMessage message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(SysMessage message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
LOGGER.info("【MQ-{}】handleMessage(SysMessage message) 数据接收成功:{}",PlatformConstWords.IMPP_MESSAGE_LETTER_QUEUE_BAK, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.schedulejob;
|
||||||
|
|
||||||
|
import cn.estsh.impp.framework.base.schedule.BaseImppScheduleJob;
|
||||||
|
import cn.estsh.impp.framework.boot.init.ApplicationProperties;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description :
|
||||||
|
* @Reference :
|
||||||
|
* @Author : alwaysfrin
|
||||||
|
* @CreateDate : 2019-03-12 17:51
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@ApiOperation("测试微服定时任务demo")
|
||||||
|
public class DemoCloudJob extends BaseImppScheduleJob {
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(DemoJob.class);
|
||||||
|
|
||||||
|
public DemoCloudJob() {
|
||||||
|
super(DemoJob.class,"测试微服定时任务demo");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeImppJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
|
||||||
|
System.out.println("==============测试微服定时任务demo===========");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,103 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysBarcodeRuleService;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysBarcodeRule;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.SysBarcodeRuleRepository;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 条码规则服务
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2019-03-12 16:13
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class SysBarcodeRuleService implements ISysBarcodeRuleService {
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysBarcodeRuleService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysBarcodeRuleRepository sysBarcodeRuleRDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "新增条码规则信息")
|
||||||
|
public SysBarcodeRule insertSysBarcodeRule(SysBarcodeRule barcodeRule) {
|
||||||
|
// 数据校验
|
||||||
|
if (sysBarcodeRuleRDao.isExitByProperty("barcodeRuleCode",barcodeRule.getBarcodeRuleCode())) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
||||||
|
.setErrorDetail("规则代码已存在")
|
||||||
|
.setErrorSolution("请重新输入规则代码")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sysBarcodeRuleRDao.insert(barcodeRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "更新条码规则信息")
|
||||||
|
public void updateSysBarcodeRule(SysBarcodeRule barcodeRule) {
|
||||||
|
List list = sysBarcodeRuleRDao.findByHqlWhere(CoreHqlPack.packHqlSysBarcodeRuleCode(barcodeRule));
|
||||||
|
if (list.size() > 0) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
||||||
|
.setErrorDetail("规则代码已存在")
|
||||||
|
.setErrorSolution("请重新输入规则代码")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
sysBarcodeRuleRDao.update(barcodeRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "查询所有条码规则信息",notes = "查询所有条码规则信息")
|
||||||
|
public List<SysBarcodeRule> listSysBarcodeRule() {
|
||||||
|
return sysBarcodeRuleRDao.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "查询条码规则信息",notes = "根据ID查询条码规则信息")
|
||||||
|
public SysBarcodeRule getSysBarcodeRuleById(Long id) {
|
||||||
|
return sysBarcodeRuleRDao.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "根据id删除条码规则",notes = "根据id删除条码规则")
|
||||||
|
public void deleteSysBarcodeRuleById(Long id) {
|
||||||
|
sysBarcodeRuleRDao.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "根据规则代码查询条码规则",notes = "根据规则代码查询条码规则")
|
||||||
|
public SysBarcodeRule getSysBarcodeRuleByCode(String code) {
|
||||||
|
return sysBarcodeRuleRDao.getByProperty("barcodeRuleCode",code);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "根据规则代码查询条码规则",notes = "根据规则代码查询条码规则")
|
||||||
|
public ListPager<SysBarcodeRule> querySysBarcodeRuleByPager(SysBarcodeRule barcodeRule, Pager pager) {
|
||||||
|
if(barcodeRule == null) {
|
||||||
|
pager = PagerHelper.getPager(pager, sysBarcodeRuleRDao.listCount());
|
||||||
|
return new ListPager(sysBarcodeRuleRDao.listPager(pager),pager);
|
||||||
|
}else {
|
||||||
|
String hqlPack = CoreHqlPack.packHqlSysBarcodeRule(barcodeRule);
|
||||||
|
pager = PagerHelper.getPager(pager, sysBarcodeRuleRDao.findByHqlWhereCount(hqlPack));
|
||||||
|
return new ListPager(sysBarcodeRuleRDao.findByHqlWherePage(hqlPack + barcodeRule.orderBy(),pager),pager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,173 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysLabelTemplateService;
|
||||||
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||||
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
|
||||||
|
import cn.estsh.i3plus.pojo.model.platform.LabelTemplateModel;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLabelTemplate;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysLabelTemplateParam;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.SysLabelTemplateParamRepository;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.repository.SysLabelTemplateRepository;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
||||||
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 打印模板服务接口实现
|
||||||
|
* @Reference :
|
||||||
|
* @Author : siliter
|
||||||
|
* @Date : 2019-03-18 9:25
|
||||||
|
* @Modify :
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class SysLabelTemplateService implements ISysLabelTemplateService {
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger(SysLabelTemplateService.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysLabelTemplateRepository sysLabelTemplateRDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysLabelTemplateParamRepository sysLabelTemplateParamRDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "添加打印模板",notes = "添加打印模板")
|
||||||
|
public void insertSysLabelTemplate(SysLabelTemplate sysLabelTemplate) {
|
||||||
|
// 根据模板代码进行唯一性校验
|
||||||
|
int count = sysLabelTemplateRDao.findByHqlWhereCount(CoreHqlPack.packHqlSysLabelTemplate(sysLabelTemplate));
|
||||||
|
if (count > 0) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
||||||
|
.setErrorDetail("打印模板已存在")
|
||||||
|
.setErrorSolution("请检查打印模板")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
SysLabelTemplate insertResult = sysLabelTemplateRDao.insert(sysLabelTemplate);
|
||||||
|
// 新增打印模板成功
|
||||||
|
if (insertResult != null) {
|
||||||
|
// 判断模板参数是否存在,存在就进行数据操作
|
||||||
|
String paramPack = sysLabelTemplate.getParamsPack();
|
||||||
|
if (StringUtils.isNotBlank(paramPack)) {
|
||||||
|
// 新增打印模板参数
|
||||||
|
SysLabelTemplateParam templateParam;
|
||||||
|
String[] paramArr = paramPack.trim().split(",");
|
||||||
|
for (String paramItem : paramArr) {
|
||||||
|
templateParam = new SysLabelTemplateParam();
|
||||||
|
templateParam.setTemplateCode(sysLabelTemplate.getTemplateCode());
|
||||||
|
templateParam.setTemplateId(insertResult.getId());
|
||||||
|
templateParam.setTemplateParam(paramItem);
|
||||||
|
templateParam.setTemplateParamText(paramItem);
|
||||||
|
ConvertBean.serviceModelInitialize(templateParam, AuthUtil.getSessionUser().getUserName());
|
||||||
|
sysLabelTemplateParamRDao.insert(templateParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "删除打印模板",notes = "删除打印模板")
|
||||||
|
public void deleteSysLabelTemplateById(Long id) {
|
||||||
|
sysLabelTemplateRDao.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "修改打印模板",notes = "修改打印模板")
|
||||||
|
public void updateSysLabelTemplate(SysLabelTemplate sysLabelTemplate) {
|
||||||
|
SysLabelTemplate updateBefore = sysLabelTemplateRDao.getById(sysLabelTemplate.getId());
|
||||||
|
if (updateBefore == null) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.WMS.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
||||||
|
.setErrorDetail("打印模板不存在")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
//暂时根据id和模板代码作为唯一性校验
|
||||||
|
StringBuffer where = new StringBuffer();
|
||||||
|
HqlPack.getNumNOEqualPack(sysLabelTemplate.getId(), "id", where);
|
||||||
|
HqlPack.getStringEqualPack(sysLabelTemplate.getTemplateCode(), "templateCode", where);
|
||||||
|
int count = sysLabelTemplateRDao.findByHqlWhereCount(where.toString());
|
||||||
|
if (count > 0) {
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
|
||||||
|
.setErrorDetail("打印模板已存在")
|
||||||
|
.setErrorSolution("请检查打印模板")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新打印模板
|
||||||
|
sysLabelTemplateRDao.update(sysLabelTemplate);
|
||||||
|
|
||||||
|
// 判断模板参数是否存在,存在就进行数据操作
|
||||||
|
if (StringUtils.isNotBlank(sysLabelTemplate.getParamsPack())) {
|
||||||
|
// 更新打印模板参数
|
||||||
|
SysLabelTemplateParam templateParam;
|
||||||
|
String[] paramArr = sysLabelTemplate.getParamsPack().trim().split(",");
|
||||||
|
for (String paramItem : paramArr) {
|
||||||
|
templateParam = new SysLabelTemplateParam();
|
||||||
|
templateParam.setTemplateCode(sysLabelTemplate.getTemplateCode());
|
||||||
|
templateParam.setTemplateParam(paramItem);
|
||||||
|
templateParam.setTemplateId(sysLabelTemplate.getId());
|
||||||
|
templateParam.setTemplateParamText(paramItem);
|
||||||
|
ConvertBean.serviceModelUpdate(templateParam, AuthUtil.getSessionUser().getUserName());
|
||||||
|
sysLabelTemplateParamRDao.update(templateParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "查询打印模板",notes = "查询打印模板")
|
||||||
|
public List<SysLabelTemplate> ListSysLabelTemplate() {
|
||||||
|
return sysLabelTemplateRDao.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "根据编号打印模板",notes = "根据编号打印模板")
|
||||||
|
public SysLabelTemplate getSysLabelTemplateById(Long id) {
|
||||||
|
return sysLabelTemplateRDao.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "复杂分页查询打印模板",notes = "复杂分页查询打印模板")
|
||||||
|
public ListPager querySysLabelTemplateByPager(SysLabelTemplate sysLabelTemplate, Pager pager) {
|
||||||
|
if(sysLabelTemplate == null) {
|
||||||
|
pager = PagerHelper.getPager(pager, sysLabelTemplateRDao.listCount());
|
||||||
|
return new ListPager(sysLabelTemplateRDao.listPager(pager),pager);
|
||||||
|
}else {
|
||||||
|
String hqlPack = CoreHqlPack.packHqlSysLabelTemplate(sysLabelTemplate);
|
||||||
|
pager = PagerHelper.getPager(pager, sysLabelTemplateRDao.findByHqlWhereCount(hqlPack));
|
||||||
|
return new ListPager(sysLabelTemplateRDao.findByHqlWherePage(hqlPack + sysLabelTemplate.orderBy(), pager), pager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ApiOperation(value = "根据模板编号查询模板参数",notes = "根据模板编号查询模板参数")
|
||||||
|
public List<SysLabelTemplateParam> listSysLabelTemplateParam(String labelTemplateId) {
|
||||||
|
SysLabelTemplateParam templateParam = new SysLabelTemplateParam();
|
||||||
|
templateParam.setTemplateId(Long.parseLong(labelTemplateId));
|
||||||
|
return sysLabelTemplateParamRDao.findByHqlWhere(CoreHqlPack.packHqlSysLabelTemplateParams(templateParam));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LabelTemplateModel getLabelTemplateInfoById(String labelTemplateId) {
|
||||||
|
LabelTemplateModel templateModel = new LabelTemplateModel();
|
||||||
|
templateModel.setLabelTemplate(sysLabelTemplateRDao.getById(Long.parseLong(labelTemplateId)));
|
||||||
|
templateModel.setTemplateParamList(listSysLabelTemplateParam(labelTemplateId));
|
||||||
|
return templateModel;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package cn.estsh.i3plus.core.apiservice.util;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.platform.bean.SysBarcodeRule;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||||
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description : 字符串解析
|
||||||
|
* @Reference :
|
||||||
|
* @Author : yunhao
|
||||||
|
* @CreateDate : 2019-03-12 14:41
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
public class BarcodeParseUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按指定规则解析条码
|
||||||
|
* @param barcodeRule
|
||||||
|
* @param barcode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Map<String,String> parse(SysBarcodeRule barcodeRule,String barcode){
|
||||||
|
// 数据有效性校验
|
||||||
|
if(barcodeRule == null || barcode == null){
|
||||||
|
return null;
|
||||||
|
}else if(barcodeRule.getBarcodeRule() == null || barcodeRule.getBarcodeSeparator() == null){
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("条码规则不完善!")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
//特殊分隔符处理
|
||||||
|
barcodeRule.setBarcodeSeparator(barcodeRule.getBarcodeSeparator().replaceAll("\\\\","\\\\\\\\"));
|
||||||
|
barcodeRule.setBarcodeSeparator(barcodeRule.getBarcodeSeparator().replaceAll("\\|","\\\\|"));
|
||||||
|
barcodeRule.setBarcodeSeparator(barcodeRule.getBarcodeSeparator().replaceAll("\\.","\\\\."));
|
||||||
|
|
||||||
|
// 分隔条码信息
|
||||||
|
String[] barcodeKey = barcodeRule.getBarcodeRule().split(barcodeRule.getBarcodeSeparator());
|
||||||
|
String[] barcodeValue = barcode.split(barcodeRule.getBarcodeSeparator());
|
||||||
|
|
||||||
|
if(barcodeKey.length != barcodeValue.length){
|
||||||
|
throw ImppExceptionBuilder.newInstance()
|
||||||
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
||||||
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
||||||
|
.setErrorDetail("条码与规则不匹配!")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 匹配条码数据
|
||||||
|
HashMap<String,String> barcodeMap = new HashMap<>();
|
||||||
|
for (int i = 0; i < barcodeKey.length; i++) {
|
||||||
|
barcodeMap.put(barcodeKey[i],barcodeValue[i]);
|
||||||
|
}
|
||||||
|
return barcodeMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SysBarcodeRule barcodeRule = new SysBarcodeRule();
|
||||||
|
barcodeRule.setName("测试条码规则");
|
||||||
|
barcodeRule.setBarcodeRuleCode("Barcode");
|
||||||
|
barcodeRule.setBarcodeRule("SN\\ORGANIZE_CODE\\PART_NO\\QTY\\UNIT");
|
||||||
|
barcodeRule.setBarcodeSeparator("\\");
|
||||||
|
barcodeRule.setBarcodeRuleDescription("描述");
|
||||||
|
|
||||||
|
Map barcode= parse(barcodeRule,"99\\99\\99\\99\\99");
|
||||||
|
|
||||||
|
System.out.println(barcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue