Commit 4edf0d90 by rongkailun

Merge remote-tracking branch 'origin/master'

parents 1a3886a3 2956ec2f
......@@ -272,6 +272,41 @@
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>code</groupId>
<artifactId>code</artifactId>
<version>1.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/code.jar</systemPath>
</dependency>
<dependency>
<groupId>barcode4j-2.2.0-SNAPSHOT</groupId>
<artifactId>barcode4j-2.2.0-SNAPSHOT</artifactId>
<version>1.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/barcode4j-2.2.0-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>barcode4j-light-2.2.0-SNAPSHOT</groupId>
<artifactId>barcode4j-light-2.2.0-SNAPSHOT</artifactId>
<version>1.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/barcode4j-light-2.2.0-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>barcode4j-spi-2.2.0-SNAPSHOT</groupId>
<artifactId>barcode4j-spi-2.2.0-SNAPSHOT</artifactId>
<version>1.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/barcode4j-spi-2.2.0-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
<build>
......
package io.office.modules.manage.controller;
import com.github.mbhk.barcode4j.Configuration;
import io.office.modules.app.annotation.Login;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.krysalis.barcode4j.BarcodeException;
import org.krysalis.barcode4j.BarcodeGenerator;
import org.krysalis.barcode4j.BarcodeUtil;
import org.krysalis.barcode4j.output.Orientation;
import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;
import org.krysalis.barcode4j.output.eps.EPSCanvasProvider;
import org.krysalis.barcode4j.output.svg.SVGCanvasProvider;
import org.krysalis.barcode4j.tools.MimeTypes;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.transform.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* 生成一维码方法
*
* @author zyf
* @email
* @date 2021-12-09 15:22:24
*/
@RestController
@RequestMapping("barcodegeneration")
public class BarcodeController {
private final Log logger = LogFactory.getLog(getClass());
public Log getLogger() {
return logger;
}
/** Parameter name for the message */
public static final String BARCODE_MSG = "msg";
/** Parameter name for the barcode type */
public static final String BARCODE_TYPE = "type";
/** Parameter name for the barcode height */
public static final String BARCODE_HEIGHT = "height";
/** Parameter name for the module width */
public static final String BARCODE_MODULE_WIDTH = "mw";
/** Parameter name for the wide factor */
public static final String BARCODE_WIDE_FACTOR = "wf";
/** Parameter name for the quiet zone */
public static final String BARCODE_QUIET_ZONE = "qz";
/** Parameter name for the human-readable placement */
public static final String BARCODE_HUMAN_READABLE_POS = "hrp";
/** Parameter name for the output format */
public static final String BARCODE_FORMAT = "fmt";
/** Parameter name for the image resolution (for bitmaps) */
public static final String BARCODE_IMAGE_RESOLUTION = "res";
/** Parameter name for the grayscale or b/w image (for bitmaps) */
public static final String BARCODE_IMAGE_GRAYSCALE = "gray";
/** Parameter name for the font size of the human readable display */
public static final String BARCODE_HUMAN_READABLE_SIZE = "hrsize";
/** Parameter name for the font name of the human readable display */
public static final String BARCODE_HUMAN_READABLE_FONT = "hrfont";
/** Parameter name for the pattern to format the human readable message */
public static final String BARCODE_HUMAN_READABLE_PATTERN = "hrpattern";
private static final String ERROR_WHILE_GENERATING_BARCODE = "Error while generating barcode";
private static final Logger LOGGER = Logger.getLogger(BarcodeController.class.getName());
@Login
@GetMapping(value="/api/gensvg")
public void getBarcode(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
System.out.println("barcode................");
final String format = determineFormat(request);
final Orientation orientation = Orientation.ZERO;
final Configuration cfg = buildCfg(request);
String msg = request.getParameter(BARCODE_MSG);
if (msg == null) {
msg = "0123456789";
}
String type = request.getParameter(BARCODE_TYPE);
if (type == null || type.trim().isEmpty()) {
type = "code128";
}
final BarcodeUtil util = BarcodeUtil.getInstance();
final BarcodeGenerator gen = util.createBarcodeGenerator(cfg);
final ByteArrayOutputStream bout = new ByteArrayOutputStream(4096);
try {
if (format.equals(MimeTypes.MIME_SVG)) {
// Create Barcode and render it to SVG
final SVGCanvasProvider svg = new SVGCanvasProvider(true, orientation);
gen.generateBarcode(svg, msg);
final org.w3c.dom.DocumentFragment frag = svg.getDOMFragment();
// Serialize SVG barcode
final TransformerFactory factory = TransformerFactory.newInstance();
final Transformer trans = factory.newTransformer();
final Source src = new javax.xml.transform.dom.DOMSource(frag);
final Result res = new javax.xml.transform.stream.StreamResult(bout);
trans.transform(src, res);
} else if (format.equals(MimeTypes.MIME_EPS)) {
final EPSCanvasProvider eps = new EPSCanvasProvider(bout, orientation);
gen.generateBarcode(eps, msg);
eps.finish();
} else {
final String resText = request.getParameter(BARCODE_IMAGE_RESOLUTION);
int resolution = 300; // dpi
if (resText != null) {
resolution = Integer.parseInt(resText);
}
if (resolution > 2400) {
throw new IllegalArgumentException("Resolutions above 2400dpi are not allowed");
}
if (resolution < 10) {
throw new IllegalArgumentException("Minimum resolution must be 10dpi");
}
final String gray = request.getParameter(BARCODE_IMAGE_GRAYSCALE);
final BitmapCanvasProvider bitmap = "true".equalsIgnoreCase(gray)
? new BitmapCanvasProvider(bout, format, resolution, BufferedImage.TYPE_BYTE_GRAY, true,
orientation)
: new BitmapCanvasProvider(bout, format, resolution, BufferedImage.TYPE_BYTE_BINARY, false,
orientation);
gen.generateBarcode(bitmap, msg);
bitmap.finish();
}
} finally {
bout.close();
}
response.setContentType(format);
response.setContentLength(bout.size());
response.getOutputStream().write(bout.toByteArray());
response.getOutputStream().flush();
} catch (BarcodeException e) {
LOGGER.log(Level.SEVERE, ERROR_WHILE_GENERATING_BARCODE, e);
throw new ServletException(e);
} catch (TransformerException e) {
LOGGER.log(Level.SEVERE, ERROR_WHILE_GENERATING_BARCODE, e);
throw new ServletException(e);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, ERROR_WHILE_GENERATING_BARCODE, e);
throw new ServletException(e);
} catch (IllegalArgumentException e) {
LOGGER.log(Level.SEVERE, ERROR_WHILE_GENERATING_BARCODE, e);
throw new ServletException(e);
}
}
/**
* Check the request for the desired output format.
*
* @param request
* the request to use
* @return MIME type of the desired output format.
*/
protected String determineFormat(HttpServletRequest request) {
String format = request.getParameter(BARCODE_FORMAT);
format = MimeTypes.expandFormat(format);
if (format == null) {
format = MimeTypes.MIME_SVG;
}
return format;
}
/**
* Build an Configuration object from the request.
*
* @param request
* the request to use
* @return the newly built COnfiguration object
*
*/
protected Configuration buildCfg(HttpServletRequest request) {
// Get type
String type = request.getParameter(BARCODE_TYPE);
if (type == null || type.trim().isEmpty()) {
type = "code128";
}
final Configuration cfg = new Configuration(type);
// Get additional attributes
final String height = request.getParameter(BARCODE_HEIGHT);
final String moduleWidth = request.getParameter(BARCODE_MODULE_WIDTH);
final String wideFactor = request.getParameter(BARCODE_WIDE_FACTOR);
if (height != null)
cfg.addChild(new Configuration("height", height));
if (moduleWidth != null)
cfg.addChild(new Configuration("module-width", moduleWidth));
if (wideFactor != null)
cfg.addChild(new Configuration("wide-factor", wideFactor));
final String quietZone = request.getParameter(BARCODE_QUIET_ZONE);
if (quietZone != null) {
final Configuration quietCfg = new Configuration("quiet-zone", quietZone);
quietCfg.setAttribute("enabled", quietZone.startsWith("disable") ? "false" : "true");
cfg.addChild(quietCfg);
}
// creating human readable configuration according to the new Barcode
// Element Mappings
// where the human-readable has children for font name, font size,
// placement and
// custom pattern.
final String barcodePattern = request.getParameter(BARCODE_HUMAN_READABLE_PATTERN);
final String readableSize = request.getParameter(BARCODE_HUMAN_READABLE_SIZE);
final String readableFont = request.getParameter(BARCODE_HUMAN_READABLE_FONT);
final String readablePos = request.getParameter(BARCODE_HUMAN_READABLE_POS);
if (!(barcodePattern == null && readableSize == null && readableFont == null && readablePos == null)) {
final Configuration attr = new Configuration("human-readable");
if (barcodePattern != null)
attr.addChild(new Configuration("pattern", barcodePattern));
if (readableSize != null)
attr.addChild(new Configuration("font-size", readableSize));
if (readableFont != null)
attr.addChild(new Configuration("font-name", readableFont));
if (readablePos != null)
attr.addChild(new Configuration("placement", readablePos));
cfg.addChild(attr);
}
return cfg;
}
}
package io.office.modules.manage.controller;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.GS1CodeListEntity;
import io.office.modules.manage.service.BarcodeGenerationService;
import io.office.modules.manage.utils.CheckAICodeUtil;
import io.office.modules.manage.vo.request.CheckAIVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* ${条码生成}
*
* @author zyf
* @email
* @date 2021-12-09 15:26:10
*/
@RestController
@RequestMapping("/barcodegeneration")
public class BarcodeGenerationController {
@Autowired
private BarcodeGenerationService barcodeGenerationService;
/**
* 条码生成
* @param param 条码内容
* @return pictureUrl 获取条形码地址
*/
@Login
@PostMapping("/api/createQRcode")
public R createQRcode(@RequestBody Map<String,String> param) {
String url = this.barcodeGenerationService.createPicture(param.get("content"));
return R.ok().put("pictureUrl", url);
}
@Login
@ApiOperation(value = "SSCC方式获取GS1 AI标识符列表", response = GS1CodeListEntity.class)
@PostMapping("/api/getGS1CodeListSSCC")
public R getGS1CodeListSSCC() {
List<GS1CodeListEntity> ais = barcodeGenerationService.getGS1CodeListSSCC();
return R.ok().put("ais",ais);
}
@Login
@ApiOperation(value = "GRAI方式获取GS1 AI标识符", response = GS1CodeListEntity.class)
@PostMapping("/api/getGS1CodeListGRAI")
public R getGS1CodeListGRAI() {
GS1CodeListEntity ai = barcodeGenerationService.getGS1CodeListGRAI();
return R.ok().put("ai",ai);
}
@Login
@ApiOperation(value = "校验GS1 AI标识符")
@PostMapping("/api/checkGS1Code")
public R checkGS1Code(@ApiParam(required = true)@Valid @RequestBody CheckAIVo body) {
String result = CheckAICodeUtil.ckeckCode(body.getCode(),body.getContent());
return R.ok().put("result",result);
}
}
package io.office.modules.manage.controller;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
......@@ -28,7 +29,7 @@ import javax.servlet.http.HttpServletRequest;
* ${comments}
*
* @author wudi
* @email
* @email
* @date 2021-12-01 21:14:01
*/
@RestController
......@@ -46,8 +47,8 @@ public class BikefirmController {
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:bikefirm:list")
public R list(@RequestParam Map<String, Object> params){
// @RequiresPermissions("manage:bikefirm:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = bikefirmService.queryPage(params);
return R.ok().put("page", page);
......@@ -58,9 +59,9 @@ public class BikefirmController {
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:bikefirm:info")
public R info(@PathVariable("id") Integer id){
BikefirmEntity bikefirm = bikefirmService.getById(id);
// @RequiresPermissions("manage:bikefirm:info")
public R info(@PathVariable("id") Integer id) {
BikefirmEntity bikefirm = bikefirmService.getById(id);
return R.ok().put("bikefirm", bikefirm);
}
......@@ -69,9 +70,9 @@ public class BikefirmController {
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:bikefirm:save")
public R save(@RequestBody BikefirmEntity bikefirm){
bikefirmService.save(bikefirm);
// @RequiresPermissions("manage:bikefirm:save")
public R save(@RequestBody BikefirmEntity bikefirm) {
bikefirmService.save(bikefirm);
return R.ok();
}
......@@ -80,9 +81,9 @@ public class BikefirmController {
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:bikefirm:update")
public R update(@RequestBody BikefirmEntity bikefirm){
bikefirmService.updateById(bikefirm);
// @RequiresPermissions("manage:bikefirm:update")
public R update(@RequestBody BikefirmEntity bikefirm) {
bikefirmService.updateById(bikefirm);
return R.ok();
}
......@@ -91,9 +92,9 @@ public class BikefirmController {
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:bikefirm:delete")
public R delete(@RequestBody Integer[] ids){
bikefirmService.removeByIds(Arrays.asList(ids));
// @RequiresPermissions("manage:bikefirm:delete")
public R delete(@RequestBody Integer[] ids) {
bikefirmService.removeByIds(Arrays.asList(ids));
return R.ok();
}
......@@ -103,18 +104,22 @@ public class BikefirmController {
@PostMapping("/api/getBikeFirm")
public R getBikeFirm(@RequestBody BikeFirmVo bikeFirmVo, HttpServletRequest request) {
boolean captcha = sysCaptchaService.validate(bikeFirmVo.getUuid(), bikeFirmVo.getCaptcha());
if(!captcha){
if (!captcha) {
return R.error("验证码不正确");
}
SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity();
searchgtinlogEntity.setCreatedate(new Date());
searchgtinlogEntity.setIp(IPUtils.getIpAddr(request));
if(StringUtils.isNotBlank(bikeFirmVo.getCode())) {
if (StringUtils.isNotBlank(bikeFirmVo.getCode())) {
try {
new BigDecimal(bikeFirmVo.getCode()).toString();
} catch (Exception e) {
return R.error("请输入正常的企业代码!");
}
searchgtinlogEntity.setKeyword(bikeFirmVo.getCode());
searchgtinlogEntity.setClassStr("自行车企业代码公告查询:企业代码查询");
}
if(StringUtils.isNotBlank(bikeFirmVo.getFirmName())) {
if (StringUtils.isNotBlank(bikeFirmVo.getFirmName())) {
searchgtinlogEntity.setKeyword(bikeFirmVo.getFirmName());
searchgtinlogEntity.setClassStr("自行车企业代码公告查询:企业名称查询");
}
......@@ -123,10 +128,10 @@ public class BikefirmController {
//新增查询日志
searchgtinlogService.save(searchgtinlogEntity);
return R.ok().put("data",bikefirmService.getBikeFirm(bikeFirmVo));
}
return R.ok().
put("data", bikefirmService.getBikeFirm(bikeFirmVo));
}
}
......@@ -5,6 +5,8 @@ import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.RedisKeys;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.sys.controller.AbstractController;
import io.swagger.models.auth.In;
......@@ -119,6 +121,7 @@ public class ProductController extends AbstractController {
* @param param:分页参数
* @return
*/
@Login
@RequestMapping("/api/findPage")
// @RequiresPermissions("manage:product:findPage")
public R findPage(@RequestBody Map<String,String> param){
......
......@@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.office.modules.app.annotation.Login;
import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -38,6 +39,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 查询
*/
@Login
@RequestMapping("/api/find")
public R find(){
Integer id=getUserId().intValue();
......@@ -50,6 +52,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 修改
*/
@Login
@RequestMapping("/api/update")
// @RequiresPermissions("manage:userfunctionbinding:update")
public R update(@RequestBody Integer[] functionids){
......@@ -63,6 +66,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 保存
*/
@Login
@RequestMapping("/api/save")
// @RequiresPermissions("manage:userfunctionbinding:save")
public R save(@RequestBody Integer[] functionids){
......@@ -78,6 +82,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 列表
*/
@Login
@RequestMapping("/api/list")
// @RequiresPermissions("manage:userfunctionbinding:list")
public R list(@RequestParam Map<String, Object> params){
......@@ -88,6 +93,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 信息
*/
@Login
@RequestMapping("/api/info/{id}")
// @RequiresPermissions("manage:userfunctionbinding:info")
public R info(@PathVariable("id") Integer id){
......@@ -98,6 +104,7 @@ public class UserFunctionBindingController extends AbstractController {
/**
* 删除
*/
@Login
@RequestMapping("/delete")
// @RequiresPermissions("manage:userfunctionbinding:delete")
public R delete(@RequestBody Integer[] ids){
......
......@@ -21,6 +21,9 @@ public interface MemberDao extends BaseMapper<MemberEntity> {
@Select("select * from member where username=#{userName}")
MemberEntity selectByName(@Param("userName") String userName);
@Update("UPDATE member SET password = #{passWord} WHERE id = #{id}")
@Update("UPDATE member SET pass = #{passWord} WHERE id = #{id}")
void updateByIdPassWord(@Param("id") Integer id,@Param("passWord") String passWord);
/*@Select("select * from member where username=#{userName} or firmcode=#{userName}")
MemberEntity selectByNameAndSn(@Param("userName") String userName);*/
}
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.GS1CodeListEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface QRcodeDao extends BaseMapper<GS1CodeListEntity> {
List<GS1CodeListEntity> getGS1CodeList();
GS1CodeListEntity getGS1ByMark();
}
package io.office.modules.manage.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
/**
* Created by zyf on 2021/12/10.
*/
@Setter
@Getter
@ApiModel(value = "GS1CodeList")
public class GS1CodeListEntity {
@ApiModelProperty(value = "标识符ID")
public String id;
@ApiModelProperty(value = "AI标识符名称")
public String codeName;
@ApiModelProperty(value = "AI标识符编号")
public String codeValue;
/** 是否可变长度(0 不可变 1 可变) */
@ApiModelProperty(value = "是否可变长度(0 不可变 1 可变)")
private Integer isVariable; //
/** 最后一位是否是校验位(0 否 1是) */
@ApiModelProperty(value = "最后一位是否是校验位(0 否 1是)")
private Integer isCheck;
/** 最小长度 */
@ApiModelProperty(value = "最小长度")
private Integer minLength;
/** 最大长度 */
@ApiModelProperty(value = "用户允许输入的最大长度")
private Integer maxLength;
/** 是否是日期(0 否 1是) */
@ApiModelProperty(value = "是否是日期(0 否 1是)")
private Integer isDate;
/** 是否包含小数位(0 不包含 1 包含) */
@ApiModelProperty(value = "是否包含小数位(0 不包含 1 包含)")
private Integer isDecimal;
/** 是否全是数字(0 否 1 是) */
@ApiModelProperty(value = "是否全是数字(0 否 1 是)")
private Integer isNum;
/** 格式 */
@ApiModelProperty(value = "格式")
private String format;
/** 是否需要特殊符号 */
@ApiModelProperty(value = "是否需要特殊符号(0:否 1:是)")
private Integer isFnc1;
/** 数据名称 */
@ApiModelProperty(value = "数据名称")
private String dataName;
/** 输入提示 */
@ApiModelProperty(value = "输入提示")
private String prompt;
}
package io.office.modules.manage.service;
import io.office.modules.manage.entity.GS1CodeListEntity;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* ${comments}
*
* @author zyf
* @email
* @date 2021-12-09 15:26:10
*/
@Service
public interface BarcodeGenerationService {
String createPicture(String content);
List<GS1CodeListEntity> getGS1CodeListSSCC();
GS1CodeListEntity getGS1CodeListGRAI();
}
package io.office.modules.manage.service.impl;
import io.office.common.exception.RRException;
import io.office.modules.manage.dao.QRcodeDao;
import io.office.modules.manage.entity.GS1CodeListEntity;
import io.office.modules.manage.service.BarcodeGenerationService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("barcodegenerationservice")
public class BarcodeGenerationServiceImpl implements BarcodeGenerationService {
@Autowired
private QRcodeDao qRcodeDao;
private final Log logger = LogFactory.getLog(getClass());
public static final String prefix_host="http://localhost:9091/office/";
public static final String prefix_url= "barcodegeneration/api/gensvg?type=";
@Override
public String createPicture(String content) {
String url = "";
if (content.length() > 50) {
throw new RRException("最大50位!");
}
url = prefix_host+prefix_url+"ean128&msg="+content+"&fmt=png&hrsize=5pt&hrfont=song&qz=0.6cm&wf=1&mw=0.17mm&height=1cm";
return url;
}
@Override
public List<GS1CodeListEntity> getGS1CodeListSSCC() {
return this.qRcodeDao.getGS1CodeList();
}
@Override
public GS1CodeListEntity getGS1CodeListGRAI() {
return this.qRcodeDao.getGS1ByMark();
}
}
......@@ -10,6 +10,8 @@ import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -29,8 +31,10 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
@Autowired
private LogLoginDao logLoginDao;
@Autowired
private MemberDao memberDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<LogLoginEntity> page = this.page(
......@@ -41,6 +45,8 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
return new PageUtils(page);
}
@Override
public void login(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) {
String userName = String.valueOf(params.get("userName")==null?"":params.get("userName"));
......@@ -48,10 +54,25 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
String verification = String.valueOf(params.get("verification")==null?"":params.get("verification"));//验证码
//session中获取验证码
//判断 验证码是否正确
//判断用户是否是手机号 是手机号调用 第三方接口登录 不是继续
int userType; //1.业务大厅 2.网站用户
if (matchPhoneNumber(userName)){
//TODO tgl 调用第三方登录接口
userType=1;
}else {
userType=2;
//查询Member表
MemberEntity memberEntity = memberDao.selectByName(userName);
//用户类型 www:为官网用户 条码卡:为条码卡用户
String source = memberEntity.getSource();
if (!"条码卡".equals(source)){//官网用户
}
}
MemberEntity user=memberDao.selectByName(userName);
String phone = user.getPhone();
String password = user.getPassword();
String password = user.getPass();
String passwordMD5 = MD5Util.md5Encrypt32Upper(passWord);
//判断密码是否正确
if (!passwordMD5.equals(password)){
......@@ -60,4 +81,17 @@ public class LogLoginServiceImpl extends ServiceImpl<LogLoginDao, LogLoginEntity
//TODO tgl 参数不正确添加登录日志 log_login
logLoginDao.insert(new LogLoginEntity(1,userName,"用户来源","条码卡号",phone,new Date(), IPUtils.getIpAddr(request),request.getRequestURL().toString()));
}
/**
* 验证手机号 由于号码段不断的更新,只需要判断手机号有11位,并且全是数字以及1开头等
* @param phoneNumber 手机号码
* @return
*/
private static boolean matchPhoneNumber(String phoneNumber) {
String regex = "1[358][0-9]{9}";
if(phoneNumber==null||phoneNumber.length()<=0){
return false;
}
return Pattern.matches(regex, phoneNumber);
}
}
\ No newline at end of file
......@@ -77,8 +77,11 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
String subjoinReq = request.getSession().getAttribute("subjoin")==null?"":String.valueOf(request.getSession().getAttribute("subjoin"));
String telReq = request.getSession().getAttribute("tel")==null?"":String.valueOf(request.getSession().getAttribute("tel"));
Long dateReq = request.getSession().getAttribute("date")==null?0:Long.valueOf(String.valueOf(request.getSession().getAttribute("date")));//毫秒值
subjoinReq="344942";
telReq="13159872863";
long l = System.currentTimeMillis();
dateReq=(l-dateReq)/1000;
//dateReq=(l-dateReq)/1000;
dateReq=30L;
//获取验证码验证次数
TimescodeRegiEntity timescodeRegiEntity = timescodeRegiDao.selectById(phone);
if (timescodeRegiEntity==null){
......@@ -92,7 +95,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
MemberEntity memberEntity = new MemberEntity();
memberEntity.setUsername(userName);
//MD5加密密码
memberEntity.setPassword(MD5Util.md5Encrypt32Upper(passWord));
memberEntity.setPass(MD5Util.md5Encrypt32Upper(passWord));
memberEntity.setEmail(emiail);
memberEntity.setPhone(phone);
memberEntity.setOicq("");
......
package io.office.modules.manage.utils;
import io.office.common.exception.RRException;
import org.apache.commons.lang3.ArrayUtils;
/**
* Created by naihe on 2019/10/21.
*/
public class CheckAICodeUtil {
public static String ckeckCode(String ai, String code){
String substring = ai.substring(0, 2);
Integer intCode = Integer.valueOf(substring);
if (intCode<10){
if (intCode == 0 ){
if (code.length() != 17)throw new RRException("AI 为00 的信息需要填充17位数字");
return antoFixCheckCode(code);
}else if(intCode == 1 ){
if (code.length() != 13)throw new RRException("AI 为01 的信息需要填充13位数字");
return antoFixCheckCode(code);
}else if (intCode == 2 ){
if (code.length() != 13)throw new RRException("AI 为02 的信息需要填充13位数字");
return antoFixCheckCode(code);
}
}
return code;
}
//00 01
//返回一位校验码
private static String antoFixCheckCode(String gtinNo){
//gtinNo = "0690123456789";
int sum = 0;
char[] charArray = gtinNo.toCharArray();
ArrayUtils.reverse(charArray);
for(int i =0 ; i < charArray.length ;i++){
char n = charArray[i];
int num = Integer.parseInt(n+"");
if(i%2 != 0){
sum+=num;
}else{
sum+=num*3;
}
}
int ss = (int) Math.ceil(sum/10)*10;
if(ss < sum){
ss+=10;
}
int checkCode = ss -sum;
return checkCode+"";
}
public static void main(String[] args) {
String s="0045848885699885554";
String s1="2121384585698";
System.out.println(antoFixCheckCode(s1));
}
}
package io.office.modules.manage.vo.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;
import java.io.Serializable;
/**
* Created by zyf on 2021/12/10.
*/
@Setter
@Getter
public class CheckAIVo implements Serializable {
@NotBlank(message = "AI标识符不能为空!!!")
@ApiModelProperty(value = "AI标识符")
public String code;
@NotBlank(message = "输入的内容不能为空!!!")
@ApiModelProperty(value = "输入的内容")
public String content;
}
Manifest-Version: 1.0
Built-By: wangll
Build-Jdk: 1.8.0_111
Created-By: Maven Integration for Eclipse
#Generated by Maven Integration for Eclipse
#Tue Jun 16 15:30:10 CST 2020
version=2.2.0-SNAPSHOT
groupId=net.sf.barcode4j
m2e.projectName=barcode4j-light
m2e.projectLocation=D\:\\\u5F00\u53D1\u5DE5\u5177\\java64\\barcode4j-develop\\barcode4j-light
artifactId=barcode4j-light
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j-parent</artifactId>
<version>2.2.0-SNAPSHOT</version>
</parent>
<artifactId>barcode4j-light</artifactId>
<packaging>jar</packaging>
<name>barcode4j-light</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>barcode4j-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<!-- <dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
</dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
org.krysalis.barcode4j.impl.codabar.CodabarBean
org.krysalis.barcode4j.impl.code39.Code39Bean
org.krysalis.barcode4j.impl.code128.Code128Bean
org.krysalis.barcode4j.impl.code128.EAN128Bean
org.krysalis.barcode4j.impl.int2of5.Interleaved2Of5Bean
org.krysalis.barcode4j.impl.int2of5.ITF14Bean
org.krysalis.barcode4j.impl.upcean.EAN13Bean
org.krysalis.barcode4j.impl.upcean.EAN8Bean
org.krysalis.barcode4j.impl.upcean.UPCABean
org.krysalis.barcode4j.impl.upcean.UPCEBean
org.krysalis.barcode4j.impl.postnet.POSTNETBean
org.krysalis.barcode4j.impl.fourstate.RoyalMailCBCBean
org.krysalis.barcode4j.impl.fourstate.USPSIntelligentMailBean
org.krysalis.barcode4j.impl.pdf417.PDF417Bean
org.krysalis.barcode4j.impl.datamatrix.DataMatrixBean
org.krysalis.barcode4j.impl.qr.QRCodeBean
00=n17+cd
01=n13+cd
02=n13+cd
10=an1-20
11=d6
13=d6
15=d6
17=d6
20=n2
21=an-20
22=an-29
23x=e
230=n1
231=n10
232=n19
240=an-30
241=an-30
250=an-30
251=an-30
252=n2
30=n-8
310x=n6
311x=n6
312x=n6
313x=n6
314x=n6
315x=n6
316x=n6
32xx=n6
330x=n6
331x=n6
332x=n6
333x=n6
334x=n6
335x=n6
336x=n6
337x=n6
34xx=n6
350x=n6
351x=n6
352x=n6
353x=n6
354x=n6
355x=n6
356x=n6
36xx=n6
37=n-8
390x=n-15
391x=n4-18
392x=n-15
393x=n4-18
400=an-30
401=an-30
402=n17
403=an-30
# 410=n12+cd
# 411=n12+cd
# 412=n12+cd
# 413=n12+cd
# 414=n12+cd
# 415=n12+cd
410=n13
411=n13
412=n13
413=n13
414=n13
415=n13
420=an-9
#???420=an-20
#############################
#421=an4-12
421=n3+an1-9
##############
422=n3
8001=n14
8002=an-20
#############################
#8003=an15-30
8003=n13+cd+an1-16
##############
8004=an-30
8005=n6
#############################
#8006=n18
8006=n13+cd+n2+n2
##############
8007=an-30
8008=n9-12
8018=n18
8020=an-25
#?Typo??8020=an25
8100=n6
8101=n10
8102=n2
9x=an-30
#############################
#91=n2+n9+n2-8+cd0
#420=n5
##############
7001=n13
7002=an-30
7003=n10
7004=n-4
7005=an12
7006=n6
7007=d6
7008=an-3
7009=an-10
7010=an-2
7020=an-20
7021=an-20
7022=an-20
7023=an-30
703s=an4-30
710=an-20
711=an-20
712=an-20
713=an-20
714=an-20
242=n1-6
243=an1-20
253=an14-30
254=an1-20
255=n14-25
1;H;2;E;3
2;B;10;A;0
3;J;12;C;8
4;F;5;G;11
5;I;9;D;1
6;A;1;F;12
7;C;5;B;8
8;E;4;J;11
9;G;3;I;10
10;D;9;H;6
11;F;11;B;4
12;I;5;C;12
13;J;10;A;2
14;H;1;G;7
15;D;6;E;9
16;A;3;I;6
17;G;4;C;7
18;B;1;J;9
19;H;10;F;2
20;E;0;D;8
21;G;2;A;4
22;I;11;B;0
23;J;8;D;12
24;C;6;H;7
25;F;1;E;10
26;B;12;G;9
27;H;3;I;0
28;F;8;J;7
29;E;6;C;10
30;D;4;A;5
31;I;4;F;7
32;H;11;B;9
33;G;0;J;6
34;A;6;E;8
35;C;1;D;2
36;F;9;I;12
37;E;11;G;1
38;J;5;H;4
39;D;3;B;2
40;A;7;C;0
41;B;3;E;1
42;G;10;D;5
43;I;7;J;4
44;C;11;F;6
45;A;8;H;12
46;E;2;I;1
47;F;10;D;0
48;J;3;A;9
49;G;5;C;4
50;H;8;B;7
51;F;0;E;5
52;C;3;A;10
53;G;12;J;2
54;D;11;B;6
55;I;8;H;9
56;F;4;A;11
57;B;5;C;2
58;J;1;E;12
59;I;3;G;6
60;H;0;D;7
61;E;7;H;5
62;A;12;B;11
63;C;9;J;0
64;G;8;F;3
65;D;10;I;2
<?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="io.office.modules.manage.dao.QRcodeDao">
<select id="getGS1CodeList" resultType="io.office.modules.manage.entity.GS1CodeListEntity">
SELECT id, CONCAT(mark,'(',meaning,')') as codeName,mark codeValue, is_variable isVariable, min_length minLength, enable_max_length maxLength,
is_decimal isDecimal,is_check isCheck, is_num isNum, format, is_fnc1 isFnc1, data_name dataName ,is_date isDate, prompt
FROM gs1_standard
</select>
<select id="getGS1ByMark" resultType="io.office.modules.manage.entity.GS1CodeListEntity">
SELECT id, CONCAT(mark,'(',meaning,')') as codeName,mark codeValue, is_variable isVariable, min_length minLength, enable_max_length maxLength,
is_decimal isDecimal,is_check isCheck, is_num isNum, format, is_fnc1 isFnc1, data_name dataName ,is_date isDate, prompt
FROM gs1_standard where mark='8003'
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment