Commit 0e3af9da by 邓实川 Committed by chenzg

登录注册、企业中心bug修复

parent 79cd0c2d
...@@ -372,6 +372,18 @@ ...@@ -372,6 +372,18 @@
<artifactId>UserAgentUtils</artifactId> <artifactId>UserAgentUtils</artifactId>
<version>1.2.4</version> <version>1.2.4</version>
</dependency> </dependency>
<!-- Zxing-二维码 -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.0</version>
</dependency>
</dependencies> </dependencies>
......
...@@ -6,9 +6,12 @@ import java.text.SimpleDateFormat; ...@@ -6,9 +6,12 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
...@@ -16,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -16,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -63,58 +67,87 @@ public class LoginController { ...@@ -63,58 +67,87 @@ public class LoginController {
@Value("${config-8timer.register-free-time}") @Value("${config-8timer.register-free-time}")
public Integer offset; // 系统赠送时间 public Integer offset; // 系统赠送时间
/* @Value("${config-8timer.register-company-max-num}")
* @Value("${config-8timer.Aliyun.PROJECT_NAME}") private String PROJECT_NAME; public Integer max;
*
* @Value("${config-8timer.Aliyun.REGION_ID}") private String REGION_ID; @Value("${config-8timer.Aliyun.PROJECT_NAME}")
* private String PROJECT_NAME;
* @Value("${config-8timer.Aliyun.ACCESSKEY_ID}") private String ACCESSKEY_ID;
* @Value("${config-8timer.Aliyun.REGION_ID}")
* @Value("${config-8timer.Aliyun.SECRET}") private String SECRET; private String REGION_ID;
*
* public static String host; public static String PROJECT_ID; public static @Value("${config-8timer.Aliyun.ACCESSKEY_ID}")
* String PROJECT_SECRET; private String ACCESSKEY_ID;
*
* @Value("${config-8timer.esign.host}") private String host_s; @Value("${config-8timer.Aliyun.SECRET}")
* private String SECRET;
* @Value("${config-8timer.esign.PROJECT_ID}") private String PROJECT_ID_s;
* public static String host;
* @Value("${config-8timer.esign.PROJECT_SECRET}") private String public static String PROJECT_ID;
* PROJECT_SECRET_s; public static String PROJECT_SECRET;
*
* @PostConstruct public void init() { host = host_s; PROJECT_ID = PROJECT_ID_s; @Value("${config-8timer.esign.host}")
* PROJECT_SECRET = PROJECT_SECRET_s; } private String host_s;
*
* @Value("${config-8timer.Aliyun.PROJECT_NAME}") private String endpoint; @Value("${config-8timer.esign.PROJECT_ID}")
* private String PROJECT_ID_s;
* @Value("${config-8timer.Aliyun.ACCESSKEY_ID}") private String accessKeyId;
* @Value("${config-8timer.esign.PROJECT_SECRET}")
* @Value("${config-8timer.Aliyun.SECRET}") private String accessKeySecret; private String PROJECT_SECRET_s;
*
* @Value("${config-8timer.Aliyun.bucketName}") private String bucketName; @PostConstruct
* public void init() {
* @Value("${config-8timer.Aliyun.bucketName_pri}") private String host = host_s;
* bucketName_pri; PROJECT_ID = PROJECT_ID_s;
* PROJECT_SECRET = PROJECT_SECRET_s;
* @Value("${config-8timer.Aliyun.project_package}") private String }
* project_package;
* @Value("${config-8timer.Aliyun.PROJECT_NAME}")
* @Value("${config-8timer.Aliyun.expirationTime}") private String private String endpoint;
* expirationTime;
* @Value("${config-8timer.Aliyun.ACCESSKEY_ID}")
* @Value("${config-8timer.Aliyun.expirationTime_pri}") private String private String accessKeyId;
* expirationTime_pri;
* @Value("${config-8timer.Aliyun.SECRET}")
* @GetMapping(value = "/test") public Map<String, Object> test() { Map<String, private String accessKeySecret;
* Object> map = new HashMap<String, Object>(); map.put("1", offset);
* map.put("2", PROJECT_NAME); map.put("3", REGION_ID); map.put("4", @Value("${config-8timer.Aliyun.bucketName}")
* ACCESSKEY_ID); map.put("5", SECRET); map.put("6", host); map.put("7", private String bucketName;
* PROJECT_ID); map.put("8", PROJECT_SECRET); map.put("9", endpoint);
* map.put("10", accessKeyId); map.put("11", accessKeySecret); map.put("12", @Value("${config-8timer.Aliyun.bucketName_pri}")
* bucketName); map.put("13", bucketName_pri); map.put("14", project_package); private String bucketName_pri;
* map.put("15", expirationTime); map.put("16", expirationTime_pri); return map;
* } @Value("${config-8timer.Aliyun.project_package}")
*/ private String project_package;
@Value("${config-8timer.Aliyun.expirationTime}")
private String expirationTime;
@Value("${config-8timer.Aliyun.expirationTime_pri}")
private String expirationTime_pri;
@GetMapping(value = "/test")
public Map<String, Object> test() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("1", offset);
map.put("2", PROJECT_NAME);
map.put("3", REGION_ID);
map.put("4", ACCESSKEY_ID);
map.put("5", SECRET);
map.put("6", host);
map.put("7", PROJECT_ID);
map.put("8", PROJECT_SECRET);
map.put("9", endpoint);
map.put("10", accessKeyId);
map.put("11", accessKeySecret);
map.put("12", bucketName);
map.put("13", bucketName_pri);
map.put("14", project_package);
map.put("15", expirationTime);
map.put("16", expirationTime_pri);
map.put("test1", max);
return map;
}
@Autowired @Autowired
private HttpSession session; private HttpSession session;
...@@ -143,10 +176,14 @@ public class LoginController { ...@@ -143,10 +176,14 @@ public class LoginController {
public Result<String> sendCode(@RequestBody EntRegisterDto entRegisterDto) { public Result<String> sendCode(@RequestBody EntRegisterDto entRegisterDto) {
String phone = entRegisterDto.getPhone(); String phone = entRegisterDto.getPhone();
if (phone == null || StrUtil.hasBlank(phone)) {
return ResultUtil.error("请输入手机号");
}
Integer orgCode = null; Integer orgCode = null;
if (entRegisterDto.getTc() != 4) { // 如果不是注册,则判断 if (entRegisterDto.getTc() != 4) { // 如果不是注册,则判断
orgCode = QyzxEmpLogin.builder().build() QyzxEmpLogin qyzxEmpLogin = QyzxEmpLogin.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone)).getOrgId(); .selectOne(new LambdaQueryWrapper<QyzxEmpLogin>().eq(QyzxEmpLogin::getPhone, phone));
orgCode = qyzxEmpLogin.getOrgId();
QyzxRemainingQuantity quantity = QyzxRemainingQuantity.builder().build() QyzxRemainingQuantity quantity = QyzxRemainingQuantity.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>() .selectOne(new LambdaQueryWrapper<QyzxRemainingQuantity>()
.eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1) .eq(QyzxRemainingQuantity::getOrgCode, orgCode).eq(QyzxRemainingQuantity::getPmid, 1)
...@@ -158,7 +195,7 @@ public class LoginController { ...@@ -158,7 +195,7 @@ public class LoginController {
date = quantity.getExpireDate(); date = quantity.getExpireDate();
} }
if (quantity == null || remainder == null || remainder <= 0) { // 判断充了钱没 if (remainder == null || remainder <= 0) { // 判断充了钱没
return ResultUtil.error("请充值后使用短信功能!"); return ResultUtil.error("请充值后使用短信功能!");
} }
if (date != null && date.getTime() <= new Date().getTime()) { if (date != null && date.getTime() <= new Date().getTime()) {
...@@ -414,17 +451,16 @@ public class LoginController { ...@@ -414,17 +451,16 @@ public class LoginController {
* TransactionStatus status = transactionManager.getTransaction(def); * TransactionStatus status = transactionManager.getTransaction(def);
*/ */
try { try {
String username = entRegisterDto.getUsername();
String phone = entRegisterDto.getPhone(); String phone = entRegisterDto.getPhone();
if (phone == null || phone.equals("") && username == null || username.equals("")) { String username = entRegisterDto.getUsername();
return ResultUtil.error("请输入手机号和用户名!");
}
if (phone == null || phone.equals(""))
phone = username;
if (username == null || username.equals(""))
username = phone;
String name = entRegisterDto.getName(); String name = entRegisterDto.getName();
String pw = entRegisterDto.getPw(); String pw = entRegisterDto.getPw();
if ((phone == null || StrUtil.hasBlank(phone)) || (username == null || StrUtil.hasBlank(username))
|| (name == null || StrUtil.hasBlank(name)) || (pw == null || StrUtil.hasBlank(pw))) {
return ResultUtil.error("用户信息不能为空");
}
QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper) QyzxEmpLogin login = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
.eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one(); .eq(!StrUtil.hasBlank(phone), QyzxEmpLogin::getPhone, phone).one();
if (login != null) { if (login != null) {
...@@ -432,7 +468,7 @@ public class LoginController { ...@@ -432,7 +468,7 @@ public class LoginController {
.eq(QyzxEmpEntAsso::getEmpNum, login.getId()) .eq(QyzxEmpEntAsso::getEmpNum, login.getId())
.eq(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType()).count(); .eq(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType()).count();
if (count > 0) { if (count > max) {
return ResultUtil.error("已注册过企业"); return ResultUtil.error("已注册过企业");
} }
} }
...@@ -467,18 +503,17 @@ public class LoginController { ...@@ -467,18 +503,17 @@ public class LoginController {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultUtil.error("注册企业失败2"); return ResultUtil.error("注册企业失败2");
} }
}
boolean b4 = YgglMainEmp.builder().orgCode(qyzxEntInfoM.getId()).empNum(qyzxEmpLogin.getId())
.name(username).build().insert(); boolean b4 = YgglMainEmp.builder().orgCode(qyzxEntInfoM.getId()).empNum(login.getId())
if (!b4) { .name(username).build().insert();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); if (!b4) {
return ResultUtil.error("注册企业失败3"); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} return ResultUtil.error("注册企业失败3");
} }
// 员工企业关联表 // 员工企业关联表
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(qyzxEntInfoM.getId()) QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(qyzxEntInfoM.getId()).status(1)
.userType(CommonEnum.U_TYPE_ADMIN.getType()).build(); .userType(CommonEnum.U_TYPE_ADMIN.getType()).build();
boolean b3 = qyzxEmpEntAsso.insert(); boolean b3 = qyzxEmpEntAsso.insert();
if (!b3) { if (!b3) {
...@@ -532,7 +567,8 @@ public class LoginController { ...@@ -532,7 +567,8 @@ public class LoginController {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
List<QysDto> qys = qyzxEmpLoginMapper.getQys(qyzxEmpLogin1.getId()); List<QysDto> qys = qyzxEmpLoginMapper.getQys(qyzxEmpLogin1.getId()
);
if (qys.size() == 0) if (qys.size() == 0)
return ResultUtil.error("没有任何公司可以查看!"); return ResultUtil.error("没有任何公司可以查看!");
qyzxEmpLogin1.setQys(qys); qyzxEmpLogin1.setQys(qys);
......
...@@ -134,9 +134,8 @@ public class CmsController { ...@@ -134,9 +134,8 @@ public class CmsController {
@ApiOperation(value = "分类内容获取", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "分类内容获取", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getType(@CurrentUser UserBean userBean) { public Result<Object> getType(@CurrentUser UserBean userBean) {
// 分类模块信息 // 分类模块信息
List<CmsContentModular> list = CmsContentModular.builder().build().selectList( List<CmsContentModular> list = CmsContentModular.builder().build()
new QueryWrapper<CmsContentModular>() .selectList(new QueryWrapper<CmsContentModular>().eq("is_open", 0) // 是否开启
.eq("is_open", 0) //是否开启
// .eq("organization_id", userBean.getOrgCode()) // .eq("organization_id", userBean.getOrgCode())
); );
List<List<CmsContent>> o = new ArrayList<List<CmsContent>>(); List<List<CmsContent>> o = new ArrayList<List<CmsContent>>();
...@@ -160,11 +159,9 @@ public class CmsController { ...@@ -160,11 +159,9 @@ public class CmsController {
@GetMapping(value = "/xxfl") @GetMapping(value = "/xxfl")
@ApiOperation(value = "获取分类", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取分类", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getxxfl(@CurrentUser UserBean userBean) { public Result<Object> getxxfl(@CurrentUser UserBean userBean) {
return ResultUtil.data(CmsContentModular.builder().build().selectList( return ResultUtil.data(CmsContentModular.builder().build().selectList(new QueryWrapper<CmsContentModular>()
new QueryWrapper<CmsContentModular>()
// .eq("organization_id", userBean.getOrgCode()) // .eq("organization_id", userBean.getOrgCode())
.eq("is_open", 0)), .eq("is_open", 0)), "查询分类成功!");
"查询分类成功!");
} }
/** /**
...@@ -298,16 +295,13 @@ public class CmsController { ...@@ -298,16 +295,13 @@ public class CmsController {
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage()); qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper queryWrapper.eq("organization_id", userBean.getOrgCode()).eq("status", 1)
.eq("organization_id", userBean.getOrgCode()) .eq(t != null && t > -1, "modularid", t).eq(r != null && r > -1, "releasestate", r)
.eq("status", 1).eq(t != null && t > -1, "modularid", t) .between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime",
.eq(r != null && r > -1, "releasestate", r)
.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime",
!StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00", !StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00",
!StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00") !StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00")
.and(!StrUtil.hasBlank(q), wq -> wq.like("userid", q) .and(!StrUtil.hasBlank(q), wq -> wq.like("userid", q).or().like("author", q).or().like("title", q))
.or().like("author", q).or().like("title", q)) .orderByDesc("addeddate");
.orderByDesc("addeddate");
IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper); IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper);
List<CmsContent> cmsContents = cmsContentPage.getRecords(); List<CmsContent> cmsContents = cmsContentPage.getRecords();
cmsContentPage.getCurrent(); cmsContentPage.getCurrent();
...@@ -355,8 +349,7 @@ public class CmsController { ...@@ -355,8 +349,7 @@ public class CmsController {
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage()); qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
// 查询条件 // 查询条件
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper queryWrapper.eq("organization_id", userBean.getOrgCode())
.eq("organization_id", userBean.getOrgCode())
.select("id", "auditopinion", "modularid", "status", "title", "releasetime", "addeddate", "author", .select("id", "auditopinion", "modularid", "status", "title", "releasetime", "addeddate", "author",
"summary", "releasetype", "fmtpath") "summary", "releasetype", "fmtpath")
.ne("status", 1).eq(t != null && t > -1, "modularid", t) .ne("status", 1).eq(t != null && t > -1, "modularid", t)
...@@ -492,6 +485,7 @@ public class CmsController { ...@@ -492,6 +485,7 @@ public class CmsController {
qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(), qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(),
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage()); qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
QueryWrapper<CmsAnnouncement> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsAnnouncement> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", userBean.getOrgCode());
queryWrapper.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "fbtime", queryWrapper.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "fbtime",
!StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00", !StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00") !StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00", !StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00")
.and(!StrUtil.hasBlank(q), wq -> wq.like("title", q).or().like("fbnr", q)).orderByDesc("fbtime"); .and(!StrUtil.hasBlank(q), wq -> wq.like("title", q).or().like("fbnr", q)).orderByDesc("fbtime");
...@@ -509,10 +503,11 @@ public class CmsController { ...@@ -509,10 +503,11 @@ public class CmsController {
* 查询默认轮播信息 * 查询默认轮播信息
*/ */
@GetMapping(value = "/defaultCarousel") @GetMapping(value = "/defaultCarousel")
@ApiOperation(value = "查询轮播信息", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "查询轮播信息(默认)", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> defaultCarousel(@CurrentUser UserBean userBean) { public Result<Object> defaultCarousel(@CurrentUser UserBean userBean) {
return ResultUtil.data( return ResultUtil.data(
CmsAnnouncement.builder().build().selectOne(new QueryWrapper<CmsAnnouncement>().eq("is_default", 1)), CmsAnnouncement.builder().build().selectOne(
new QueryWrapper<CmsAnnouncement>().eq("is_default", 1).eq("org_code", userBean.getOrgCode())),
"查询成功"); "查询成功");
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
package cn.timer.api.controller.qyzx; package cn.timer.api.controller.qyzx;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -29,9 +30,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -29,9 +30,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.bean.qyzx.businessService.QyzxBuyRecord; import cn.timer.api.bean.qyzx.businessService.QyzxBuyRecord;
import cn.timer.api.bean.qyzx.businessService.QyzxInvoiceData; import cn.timer.api.bean.qyzx.businessService.QyzxInvoiceData;
import cn.timer.api.bean.qyzx.businessService.QyzxOrderRecord; import cn.timer.api.bean.qyzx.businessService.QyzxOrderRecord;
...@@ -74,7 +78,7 @@ public class QyzxBusinessController { ...@@ -74,7 +78,7 @@ public class QyzxBusinessController {
@GetMapping(value = "/getQuantity") @GetMapping(value = "/getQuantity")
@ApiOperation(value = "获取套餐余量信息(数量)", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取套餐余量信息(数量)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<Map<String, Object>>> getQuantity(@CurrentUser UserBean userBean) { public Result<List<Map<String, Integer>>> getQuantity(@CurrentUser UserBean userBean) {
List<QyzxRemainingQuantity> qyzxRemainingQuantitys1 = QyzxRemainingQuantity.builder().build() List<QyzxRemainingQuantity> qyzxRemainingQuantitys1 = QyzxRemainingQuantity.builder().build()
.selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>().eq(QyzxRemainingQuantity::getIsDelete, 0) .selectList(new LambdaQueryWrapper<QyzxRemainingQuantity>().eq(QyzxRemainingQuantity::getIsDelete, 0)
.eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode()) .eq(QyzxRemainingQuantity::getOrgCode, userBean.getOrgCode())
...@@ -89,16 +93,38 @@ public class QyzxBusinessController { ...@@ -89,16 +93,38 @@ public class QyzxBusinessController {
Integer sum2 = qyzxRemainingQuantitys2.stream() Integer sum2 = qyzxRemainingQuantitys2.stream()
.collect(Collectors.summingInt(QyzxRemainingQuantity::getRemainder)); .collect(Collectors.summingInt(QyzxRemainingQuantity::getRemainder));
Map<String, Object> map1 = new HashMap<String, Object>(); Map<String, Integer> map1 = new HashMap<String, Integer>();
map1.put("message", sum1); map1.put("message", sum1);
Map<String, Object> map2 = new HashMap<String, Object>(); Map<String, Integer> map2 = new HashMap<String, Integer>();
map2.put("contract", sum2); map2.put("contract", sum2);
List<Map<String, Integer>> list = new ArrayList<Map<String, Integer>>();
list.add(map1);
list.add(map2);
return ResultUtil.data(list, "获取成功");
}
@GetMapping(value = "/getQuantity/System")
@ApiOperation(value = "获取系统剩余天数、版本", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getSystemQuantity(@CurrentUser UserBean userBean) {
QyzxEntInfoM qyzxEntInfoM = QyzxEntInfoM.builder().build()
.selectOne(new LambdaQueryWrapper<QyzxEntInfoM>().eq(QyzxEntInfoM::getId, userBean.getOrgCode()));
Date endTime = qyzxEntInfoM.getEndTime();
Long day = DateUtil.between(new Date(), endTime, DateUnit.DAY,false);
Integer level = qyzxEntInfoM.getLevel();
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("betweenDay", day);
Map<String, Object> map2 = new HashMap<String, Object>();
map2.put("level", level);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
list.add(map1); list.add(map1);
list.add(map2); list.add(map2);
return ResultUtil.data(list, "获取成功"); return ResultUtil.data(list, "获取成功");
} }
@GetMapping(value = "/getPayList/Contract") @GetMapping(value = "/getPayList/Contract")
......
/**
* <p>Title: LogoUtil.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月28日
* @version 1.0
*/
package cn.timer.api.utils.QRCode;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.geom.RoundRectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* <p>
* Title: LogoUtil.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年4月28日
* @version 1.0
*/
public class LogoUtil {
// 传入logo、二维码 ->带logo的二维码
public static BufferedImage logoMatrix(BufferedImage matrixImage, String logo) throws IOException {
// 在二维码上画logo:产生一个 二维码画板
Graphics2D g2 = matrixImage.createGraphics();
// 画logo: String->BufferedImage(内存)
BufferedImage logoImg = ImageIO.read(new File(logo));
int height = matrixImage.getHeight();
int width = matrixImage.getWidth();
// 纯logo图片
g2.drawImage(logoImg, width * 2 / 5, height * 2 / 5, width * 1 / 5, height * 1 / 5, null);
// 产生一个 画 白色圆角正方形的 画笔
BasicStroke stroke = new BasicStroke(5, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
// 将画板-画笔 关联
g2.setStroke(stroke);
// 创建一个正方形
RoundRectangle2D.Float round = new RoundRectangle2D.Float(width * 2 / 5, height * 2 / 5, width * 1 / 5,
height * 1 / 5, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
g2.setColor(Color.WHITE);
g2.draw(round);
// 灰色边框
BasicStroke stroke2 = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
g2.setStroke(stroke2);
// 创建一个正方形
RoundRectangle2D.Float round2 = new RoundRectangle2D.Float(width * 2 / 5 + 2, height * 2 / 5 + 2,
width * 1 / 5 - 4, height * 1 / 5 - 4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
// Color color = new Color(128,128,128) ;
g2.setColor(Color.GRAY);
g2.draw(round2);
g2.dispose();
matrixImage.flush();
return matrixImage;
}
}
/**
* <p>Title: QRCodeUtil.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月28日
* @version 1.0
*/
package cn.timer.api.utils.QRCode;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Hashtable;
import javax.imageio.ImageIO;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;;
/**
* <p>
* Title: QRCodeUtil.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年4月28日
* @version 1.0
*/
public class ZXingUtil {
/**
* @param imgPath 保存路径
* @param format 图片格式
* @param content 保存内容
* @param width 宽
* @param height 高
* @param logo logo图片路径
* @throws Exception
*/
public static void encodeImg(String imgPath, String format, String content, int width, int height, String logo)
throws Exception {
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
// 排错率 L<M<Q<H
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
// 编码
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
// 外边距:margin
hints.put(EncodeHintType.MARGIN, 1);
/*
* content : 需要加密的 文字 BarcodeFormat.QR_CODE:要解析的类型(二维码) hints:加密涉及的一些参数:编码、排错率
*/
BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints);
// 内存中的一张图片:此时需要的图片 是二维码-> 需要一个boolean[][] ->BitMatrix
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
image.setRGB(x, y, (bitMatrix.get(x, y) ? 0 : 16777215)); // TODO
}
}
// 画logo
image = LogoUtil.logoMatrix(image, logo);
// string->file
File file = new File(imgPath);
// 生成图片
ImageIO.write(image, format, file);
}
/*
* public static void main(String[] args) { String imgPath =
* "C:\\Users\\Lenovo\\Desktop\\8timer.png"; String content = "8timer.cn";
* String logo = "C:\\Users\\Lenovo\\Pictures\\Saved Pictures\\生气.jpg"; //
* 加密:文字信息->二维码 try { ZXingUtil.encodeImg(imgPath, "png", content, 430, 430,
* logo); } catch (Exception e) { e.printStackTrace(); } }
*/
}
\ No newline at end of file
...@@ -86,7 +86,7 @@ public class AliyunSMS { ...@@ -86,7 +86,7 @@ public class AliyunSMS {
Date date = quantity.getExpireDate(); Date date = quantity.getExpireDate();
orderNo = quantity.getOrderNo(); orderNo = quantity.getOrderNo();
if (quantity == null || remainder == null || remainder <= 0) { if (remainder == null || remainder <= 0) {
System.err.println("企业 " + orgCode + " :套餐余额不足,请充钱"); System.err.println("企业 " + orgCode + " :套餐余额不足,请充钱");
return null; return null;
} }
......
...@@ -151,6 +151,7 @@ logging: ...@@ -151,6 +151,7 @@ logging:
config-8timer: config-8timer:
register-free-time: 90 #系统赠送时间 register-free-time: 90 #系统赠送时间
register-company-max-num: 100
Aliyun: # 阿里云 Aliyun: # 阿里云
PROJECT_NAME: 8小时人事管家 PROJECT_NAME: 8小时人事管家
REGION_ID: cn-shenzhen REGION_ID: cn-shenzhen
......
...@@ -127,6 +127,7 @@ logging: ...@@ -127,6 +127,7 @@ logging:
config-8timer: config-8timer:
register-free-time: 90 #系统赠送时间 register-free-time: 90 #系统赠送时间
register-company-max-num: 100
Aliyun: # 阿里云 Aliyun: # 阿里云
PROJECT_NAME: 8小时人事管家 PROJECT_NAME: 8小时人事管家
REGION_ID: cn-shenzhen REGION_ID: cn-shenzhen
......
...@@ -127,6 +127,7 @@ logging: ...@@ -127,6 +127,7 @@ logging:
config-8timer: config-8timer:
register-free-time: 90 #系统赠送时间 register-free-time: 90 #系统赠送时间
register-company-max-num: 100
Aliyun: # 阿里云 Aliyun: # 阿里云
PROJECT_NAME: 8小时人事管家 PROJECT_NAME: 8小时人事管家
REGION_ID: cn-shenzhen REGION_ID: cn-shenzhen
......
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