Commit efd7644e by 吴迪

bug修改

parent 589f3680
...@@ -329,6 +329,11 @@ ...@@ -329,6 +329,11 @@
<version>3.8.1</version> <version>3.8.1</version>
</dependency> </dependency>
<dependency>
<groupId>com.sitech</groupId>
<artifactId>idwork-starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -4,17 +4,21 @@ ...@@ -4,17 +4,21 @@
package io.office; package io.office;
import com.sitech.idworkstarter.IdWorkAutoConfiguration;
import io.office.modules.manage.utils.IdKeysConstant; import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.manage.utils.IdWorkerUtils; import io.office.modules.manage.utils.IdWorkerUtils;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
/** /**
* @author DELL * @author DELL
*/ */
@SpringBootApplication @SpringBootApplication
@Import(IdWorkAutoConfiguration.class)
public class OfficeApplication { public class OfficeApplication {
...@@ -23,12 +27,12 @@ public class OfficeApplication { ...@@ -23,12 +27,12 @@ public class OfficeApplication {
} }
@PostConstruct /* @PostConstruct
private void initSeq(){ private void initSeq(){
System.out.println("初始化100000个序列开始"); System.out.println("初始化100000个序列开始");
IdWorkerUtils.initData(IdKeysConstant.ID_SEQ_KEY); IdWorkerUtils.initData(IdKeysConstant.ID_SEQ_KEY);
System.out.println("初始化100000个序列完成"); System.out.println("初始化100000个序列完成");
} }*/
} }
\ No newline at end of file
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
package io.office.common.utils; package io.office.common.utils;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.commons.collections.CollectionUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -104,7 +106,13 @@ public class PageUtils implements Serializable { ...@@ -104,7 +106,13 @@ public class PageUtils implements Serializable {
} }
public void setList(List<?> list) { public void setList(List<?> list) {
if(CollectionUtils.isNotEmpty(list)) {
this.list = list; this.list = list;
} }
else{
this.list = new ArrayList<>();
}
}
} }
...@@ -131,6 +131,7 @@ public class CasesController extends AbstractController { ...@@ -131,6 +131,7 @@ public class CasesController extends AbstractController {
} }
} }
} }
R r = this.casesService.delete(ids, getUser()); R r = this.casesService.delete(ids, getUser());
return r; return r;
} catch (Exception e) { } catch (Exception e) {
...@@ -187,6 +188,10 @@ public class CasesController extends AbstractController { ...@@ -187,6 +188,10 @@ public class CasesController extends AbstractController {
if (casesEntity.getStatus() != 1) { if (casesEntity.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (casesEntity.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("data", casesEntity); return R.ok().put("data", casesEntity);
......
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.GraiCodeImageEntity;
import io.office.modules.manage.service.GraiCodeImageService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-06-18 13:25:35
*/
@RestController
@RequestMapping("/graiCodeImage")
public class GraiCodeImageController {
@Autowired
private GraiCodeImageService graiCodeImageService;
/**
* 修改
*/
@Login
@RequestMapping("/api/update")
// @RequiresPermissions("datamanage:graicodeimage:update")
public R update(@RequestBody GraiCodeImageEntity graiCodeImage){
graiCodeImage.setDownloadTime(new Date());
UpdateWrapper<GraiCodeImageEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id",graiCodeImage.getId());
graiCodeImageService.update(graiCodeImage,updateWrapper);
//graiCodeImageService.updateById(graiCodeImage);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("datamanage:graicodeimage:delete")
public R delete(@RequestBody Long[] ids){
graiCodeImageService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
...@@ -9,6 +9,7 @@ import io.office.modules.manage.entity.NewsEntity; ...@@ -9,6 +9,7 @@ import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.NewsMovieEntity; import io.office.modules.manage.entity.NewsMovieEntity;
import io.office.modules.manage.entity.TopicnewsEntity; import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.entity.dto.NewsParams; import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.NewsService;
import io.office.modules.manage.service.TopicnewsService; import io.office.modules.manage.service.TopicnewsService;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -93,6 +94,8 @@ public class HotFollowController extends AbstractController { ...@@ -93,6 +94,8 @@ public class HotFollowController extends AbstractController {
} }
} }
@Autowired
NewsService newsService;
/** /**
* 删除 * 删除
*/ */
...@@ -104,10 +107,11 @@ public class HotFollowController extends AbstractController { ...@@ -104,10 +107,11 @@ public class HotFollowController extends AbstractController {
try { try {
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
for (Long id : ids) { for (Long id : ids) {
TopicnewsEntity topicnewsEntity = topicnewsService.getById(id); NewsEntity newsEntity = newsService.getById(id);
// TopicnewsEntity topicnewsEntity = (TopicnewsEntity) newsEntity;
//NewsMovieEntity newsMovieEntity = (NewsMovieEntity) topicnewsEntity; //NewsMovieEntity newsMovieEntity = (NewsMovieEntity) topicnewsEntity;
//MedicalEntity medicalServiceById = (MedicalEntity) pictureServiceById; //MedicalEntity medicalServiceById = (MedicalEntity) pictureServiceById;
if (topicnewsEntity.getNewslevels() == 0) { if (newsEntity.getLevels() == 0) {
return R.error("当前级别为0不能删除!"); return R.error("当前级别为0不能删除!");
} }
} }
......
...@@ -100,6 +100,9 @@ public class IndexCarouselManageController extends AbstractController { ...@@ -100,6 +100,9 @@ public class IndexCarouselManageController extends AbstractController {
if (indexCarouselManage.getCheckflagIndex() != 1) { if (indexCarouselManage.getCheckflagIndex() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (indexCarouselManage.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("indexCarouselManage", indexCarouselManage); return R.ok().put("indexCarouselManage", indexCarouselManage);
......
...@@ -7,6 +7,7 @@ import java.util.Map; ...@@ -7,6 +7,7 @@ import java.util.Map;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sitech.idworkstarter.IdWorkService;
import io.office.common.annotation.SysLog; import io.office.common.annotation.SysLog;
import io.office.modules.manage.entity.NewsEntity; import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.ProductEntity; import io.office.modules.manage.entity.ProductEntity;
...@@ -38,6 +39,8 @@ import io.office.common.utils.R; ...@@ -38,6 +39,8 @@ import io.office.common.utils.R;
public class LogisticsController extends AbstractController { public class LogisticsController extends AbstractController {
@Autowired @Autowired
private LogisticsService logisticsService; private LogisticsService logisticsService;
@Autowired
private IdWorkService idWorkService;
/** /**
* 列表 * 列表
...@@ -68,8 +71,8 @@ public class LogisticsController extends AbstractController { ...@@ -68,8 +71,8 @@ public class LogisticsController extends AbstractController {
@Transactional @Transactional
@RequestMapping("/save") @RequestMapping("/save")
@RequiresPermissions("manage:logistics:save") @RequiresPermissions("manage:logistics:save")
public R save(@RequestBody LogisticsEntity logistics){ public R save(@RequestBody LogisticsEntity logistics) throws IllegalArgumentException {
logistics.setId(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY)); logistics.setId(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
logistics.setInputdate(new Date()); logistics.setInputdate(new Date());
String username = getUser().getUsername(); String username = getUser().getUsername();
logistics.setEditor(username); logistics.setEditor(username);
...@@ -109,10 +112,10 @@ public class LogisticsController extends AbstractController { ...@@ -109,10 +112,10 @@ public class LogisticsController extends AbstractController {
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
for (String id : ids) { for (String id : ids) {
NewsEntity newsEntity = newsService.getById(id); LogisticsEntity logisticsEntity = logisticsService.getById(id);
// TopicnewsEntity topicnewsEntity = (TopicnewsEntity) newsEntity; // TopicnewsEntity topicnewsEntity = (TopicnewsEntity) newsEntity;
//MedicalEntity medicalServiceById = (MedicalEntity) pictureServiceById; //MedicalEntity medicalServiceById = (MedicalEntity) pictureServiceById;
if (newsEntity.getLevels() == 0) { if (logisticsEntity.getLevel() == 0) {
return R.error("当前级别为0不能删除!"); return R.error("当前级别为0不能删除!");
} }
} }
......
...@@ -3,6 +3,7 @@ package io.office.modules.manage.controller; ...@@ -3,6 +3,7 @@ package io.office.modules.manage.controller;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sitech.idworkstarter.IdWorkService;
import io.office.common.annotation.SysLog; import io.office.common.annotation.SysLog;
import io.office.modules.app.annotation.Login; import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.MedicalEntity; import io.office.modules.manage.entity.MedicalEntity;
...@@ -59,6 +60,8 @@ public class MedicalController extends AbstractController { ...@@ -59,6 +60,8 @@ public class MedicalController extends AbstractController {
return R.ok().put("medical", medical); return R.ok().put("medical", medical);
} }
@Autowired
IdWorkService idWorkService;
/** /**
* 保存 * 保存
*/ */
...@@ -66,8 +69,8 @@ public class MedicalController extends AbstractController { ...@@ -66,8 +69,8 @@ public class MedicalController extends AbstractController {
@Transactional @Transactional
@RequestMapping("/save") @RequestMapping("/save")
@RequiresPermissions("manage:medical:save") @RequiresPermissions("manage:medical:save")
public R save(@RequestBody MedicalEntity medical) { public R save(@RequestBody MedicalEntity medical) throws IllegalArgumentException {
medical.setId(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY)); medical.setId(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
String username = getUser().getUsername(); String username = getUser().getUsername();
medical.setInputDate(new Date()); medical.setInputDate(new Date());
medical.setEditor(username); medical.setEditor(username);
...@@ -90,6 +93,14 @@ public class MedicalController extends AbstractController { ...@@ -90,6 +93,14 @@ public class MedicalController extends AbstractController {
@RequiresPermissions("manage:medical:update") @RequiresPermissions("manage:medical:update")
public R update(@RequestBody MedicalEntity medical) { public R update(@RequestBody MedicalEntity medical) {
String username = getUser().getUsername(); String username = getUser().getUsername();
//先查询一下
MedicalEntity medicalEntity = medicalService.getById(medical.getId());
if(medicalEntity!=null&&StringUtils.isNotEmpty(medicalEntity.getEditor())) {
if(!username.equals(medicalEntity.getEditor())) {
return R.error("你不是此文章的编辑人,不能修改!");
}
}
//medical.setEditor(username); //medical.setEditor(username);
medical.setLasteditor(username); medical.setLasteditor(username);
medical.setUpdatetime(new Date()); medical.setUpdatetime(new Date());
...@@ -106,17 +117,27 @@ public class MedicalController extends AbstractController { ...@@ -106,17 +117,27 @@ public class MedicalController extends AbstractController {
@RequestMapping("/delete") @RequestMapping("/delete")
@RequiresPermissions("manage:medical:delete") @RequiresPermissions("manage:medical:delete")
public R delete(@RequestBody List<String> ids) { public R delete(@RequestBody List<String> ids) {
String username = getUser().getUsername();
if(CollectionUtils.isNotEmpty(ids)) { if(CollectionUtils.isNotEmpty(ids)) {
for (String id : ids) { for (String id : ids) {
MedicalEntity medicalServiceById = medicalService.getById(id); MedicalEntity medicalServiceById = medicalService.getById(id);
if(medicalServiceById.getLevel()==0) { if(medicalServiceById.getLevel()==0) {
return R.error("当前级别为0不能删除!"); return R.error("当前级别为0不能删除!");
} }
//先查询一下
MedicalEntity medicalEntity = medicalService.getById(id);
if(medicalEntity!=null&&StringUtils.isNotEmpty(medicalEntity.getEditor())) {
if(!username.equals(medicalEntity.getEditor())) {
return R.error("你不是此文章的编辑人,不能删除!");
} }
} }
}
}
MedicalEntity medical = new MedicalEntity(); MedicalEntity medical = new MedicalEntity();
String username = getUser().getUsername();
// medical.setEditor(username); // medical.setEditor(username);
medical.setLasteditor(username); medical.setLasteditor(username);
medical.setUpdatetime(new Date()); medical.setUpdatetime(new Date());
...@@ -205,6 +226,10 @@ public class MedicalController extends AbstractController { ...@@ -205,6 +226,10 @@ public class MedicalController extends AbstractController {
if (medicalEntity.getStatus()!=null && !medicalEntity.getStatus().equals("1")) { if (medicalEntity.getStatus()!=null && !medicalEntity.getStatus().equals("1")) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (medicalEntity.getLevel() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("data", medicalEntity); return R.ok().put("data", medicalEntity);
......
...@@ -228,10 +228,13 @@ public class NewsController extends AbstractController { ...@@ -228,10 +228,13 @@ public class NewsController extends AbstractController {
if (news.getStatus() != 1) { if (news.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (news.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
//点击量+1 //点击量+1
NewsEntity newsUpdate = new NewsEntity(); NewsEntity newsUpdate = new NewsEntity();
if(newsUpdate.getHits()!=null) { if(news.getHits()!=null) {
newsUpdate.setHits(news.getHits()+1); newsUpdate.setHits(news.getHits()+1);
} else{ } else{
newsUpdate.setHits(1); newsUpdate.setHits(1);
...@@ -408,6 +411,10 @@ public class NewsController extends AbstractController { ...@@ -408,6 +411,10 @@ public class NewsController extends AbstractController {
if (announceEntity.getStatus() != 1) { if (announceEntity.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (announceEntity.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("data", announceEntity); return R.ok().put("data", announceEntity);
} }
...@@ -525,6 +532,9 @@ public class NewsController extends AbstractController { ...@@ -525,6 +532,9 @@ public class NewsController extends AbstractController {
if (retMap.getStatus() != 1) { if (retMap.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (retMap.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("data", retMap); return R.ok().put("data", retMap);
...@@ -647,6 +657,9 @@ public class NewsController extends AbstractController { ...@@ -647,6 +657,9 @@ public class NewsController extends AbstractController {
if (newtopic.getCheckflag() != 1) { if (newtopic.getCheckflag() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (newtopic.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("data", newtopic); return R.ok().put("data", newtopic);
} }
...@@ -807,6 +820,9 @@ public class NewsController extends AbstractController { ...@@ -807,6 +820,9 @@ public class NewsController extends AbstractController {
if (newsMovie.getStatus() != 1) { if (newsMovie.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (newsMovie.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("data", newsMovie); return R.ok().put("data", newsMovie);
......
...@@ -189,6 +189,9 @@ public class PartnersController extends AbstractController { ...@@ -189,6 +189,9 @@ public class PartnersController extends AbstractController {
if (partners.getStatus() != 1) { if (partners.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (partners.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("data", partners); return R.ok().put("data", partners);
} }
......
...@@ -217,6 +217,9 @@ public class PictureController extends AbstractController { ...@@ -217,6 +217,9 @@ public class PictureController extends AbstractController {
if (picture.getStatus() != 1) { if (picture.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (picture.getPiclevel() ==0 ) {
return R.error("没有可显示的内容");
}
} }
return R.ok().put("data", picture); return R.ok().put("data", picture);
} }
......
...@@ -224,10 +224,13 @@ public class PolicyController extends AbstractController { ...@@ -224,10 +224,13 @@ public class PolicyController extends AbstractController {
if (StrUtil.equals("0", policy.getStatus())) { if (StrUtil.equals("0", policy.getStatus())) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (policy.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
//点击量+1 //点击量+1
PolicyEntity policyUpdate = new PolicyEntity(); PolicyEntity policyUpdate = new PolicyEntity();
if (policyUpdate.getHits() != null) { if (policyUpdate.getHits() != null) {
policyUpdate.setHits(policyUpdate.getHits() + 1); policyUpdate.setHits(policy.getHits() + 1);
} else { } else {
policyUpdate.setHits(1); policyUpdate.setHits(1);
} }
......
...@@ -180,6 +180,9 @@ public class ProductController extends AbstractController { ...@@ -180,6 +180,9 @@ public class ProductController extends AbstractController {
if (productEntity.getStatus() != 1) { if (productEntity.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (productEntity.getLevels() ==0 ) {
return R.error("没有可显示的内容");
}
} }
} }
return R.ok().put("page", pageUtils); return R.ok().put("page", pageUtils);
......
...@@ -179,6 +179,9 @@ public class RetailpictureController extends AbstractController { ...@@ -179,6 +179,9 @@ public class RetailpictureController extends AbstractController {
if (picture.getStatus() != 1) { if (picture.getStatus() != 1) {
return R.error("没有可显示的内容"); return R.error("没有可显示的内容");
} }
if (picture.getPiclevel() ==0 ) {
return R.error("没有可显示的内容");
}
} }
......
package io.office.modules.manage.controller;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.office.common.utils.R;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.GraiCodeImageEntity;
import io.office.modules.manage.entity.SsccCodeImageEntity;
import io.office.modules.manage.service.SsccCodeImageService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-06-18 13:20:17
*/
@RestController
@RequestMapping("/ssccCodeImage")
public class SsccCodeImageController {
@Autowired
private SsccCodeImageService ssccCodeImageService;
@Login
@RequestMapping("/api/update")
//@RequiresPermissions("datamanage:sscccodeimage:update")
public R update(@RequestBody SsccCodeImageEntity ssccCodeImage){
ssccCodeImage.setDownloadTime(new Date());
UpdateWrapper<SsccCodeImageEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id",ssccCodeImage.getId());
ssccCodeImageService.update(ssccCodeImage,updateWrapper);
ssccCodeImageService.updateById(ssccCodeImage);
return R.ok();
}
}
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import com.sitech.idworkstarter.IdWorkService;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.R; import io.office.common.utils.R;
import io.office.modules.manage.entity.TokenCount; import io.office.modules.manage.entity.TokenCount;
...@@ -29,17 +30,18 @@ public class TokenController extends AbstractController { ...@@ -29,17 +30,18 @@ public class TokenController extends AbstractController {
@Autowired @Autowired
TokenCountService tokenCountService; TokenCountService tokenCountService;
@Autowired
IdWorkService idWorkService;
@RequestMapping("/getToken") @RequestMapping("/getToken")
// @RequiresPermissions("manage:searchgtinlog:list") // @RequiresPermissions("manage:searchgtinlog:list")
public R getToken() { public R getToken() throws IllegalArgumentException {
SysUserEntity user = getUser(); SysUserEntity user = getUser();
String token = TokenGenerator.generateValue(); String token = TokenGenerator.generateValue();
TokenCount tokenCount = new TokenCount(); TokenCount tokenCount = new TokenCount();
tokenCount.setToken(token); tokenCount.setToken(token);
tokenCount.setCreateUser(user.getUsername()); tokenCount.setCreateUser(user.getUsername());
tokenCount.setCreateTime(DateUtils.getCurrentTime(DateUtils.FORMAT1)); tokenCount.setCreateTime(DateUtils.getCurrentTime(DateUtils.FORMAT1));
tokenCount.setId(Long.parseLong(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY))); tokenCount.setId(Long.parseLong(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY)));
tokenCount.setCountFlag(0); tokenCount.setCountFlag(0);
tokenCountService.save(tokenCount); tokenCountService.save(tokenCount);
return R.ok().put("data", token); return R.ok().put("data", token);
......
...@@ -133,7 +133,7 @@ public class TopicnewsController extends AbstractController { ...@@ -133,7 +133,7 @@ public class TopicnewsController extends AbstractController {
@SysLog("审核活动报道[topicnews]") @SysLog("审核活动报道[topicnews]")
@Transactional @Transactional
@RequestMapping("/verifyTopic") @RequestMapping("/verifyTopic")
@RequiresPermissions("manage:news:check") @RequiresPermissions("manage:topicnews:check")
public R verify(@RequestBody NewsEntity news) { public R verify(@RequestBody NewsEntity news) {
try { try {
R r = this.topicnewsService.verifyTopic(news,getUser()); R r = this.topicnewsService.verifyTopic(news,getUser());
......
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.GraiCodeImageEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-06-18 13:25:35
*/
@Mapper
public interface GraiCodeImageDao extends BaseMapper<GraiCodeImageEntity> {
}
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.SsccCodeImageEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-06-18 13:20:17
*/
@Mapper
public interface SsccCodeImageDao extends BaseMapper<SsccCodeImageEntity> {
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-06-18 13:25:35
*/
@Data
@TableName("grai_code_image")
public class GraiCodeImageEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* $column.comments
*/
private String aiCode;
/**
* $column.comments
*/
private String inputCode;
/**
* $column.comments
*/
private String codeImagePath;
/**
* $column.comments
*/
private Date createTime;
/**
* $column.comments
*/
private Date downloadTime;
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-06-18 13:20:17
*/
@Data
@TableName("sscc_code_image")
public class SsccCodeImageEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* $column.comments
*/
private String aiCode;
/**
* $column.comments
*/
private String inputCode;
/**
* $column.comments
*/
private String checkCode;
/**
* $column.comments
*/
private String codeImagePath;
/**
* $column.comments
*/
private Date createTime;
/**
* $column.comments
*/
private Date downloadTime;
}
package io.office.modules.manage.entity.dto; package io.office.modules.manage.entity.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.office.modules.manage.entity.page.PageParams; import io.office.modules.manage.entity.page.PageParams;
import lombok.Data; import lombok.Data;
...@@ -17,6 +18,9 @@ public class NewsParams extends PageParams { ...@@ -17,6 +18,9 @@ public class NewsParams extends PageParams {
private String levels; private String levels;
private String author; private String author;
private String editor; private String editor;
private String content;
private String ishead;
private String keyword; private String keyword;
private String status; private String status;
private String auditor; private String auditor;
...@@ -31,6 +35,9 @@ public class NewsParams extends PageParams { ...@@ -31,6 +35,9 @@ public class NewsParams extends PageParams {
private Date updateTimeEnd; private Date updateTimeEnd;
private Integer classId; private Integer classId;
@TableField(exist = false)
private Integer cclassId;
private String type; private String type;
private List list; private List list;
......
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.modules.manage.entity.GraiCodeImageEntity;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-06-18 13:25:35
*/
public interface GraiCodeImageService extends IService<GraiCodeImageEntity> {
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.modules.manage.entity.SsccCodeImageEntity;
/**
* ${comments}
*
* @author wudi
* @email 632132852@qq.com
* @date 2023-06-18 13:20:17
*/
public interface SsccCodeImageService extends IService<SsccCodeImageEntity> {
}
package io.office.modules.manage.service.impl; package io.office.modules.manage.service.impl;
import cn.hutool.core.util.StrUtil;
import com.sitech.idworkstarter.IdWorkService;
import io.office.common.exception.RRException; import io.office.common.exception.RRException;
import io.office.common.utils.Constant;
import io.office.modules.manage.dao.QRcodeDao; import io.office.modules.manage.dao.QRcodeDao;
import io.office.modules.manage.entity.GS1CodeListEntity; import io.office.modules.manage.entity.GS1CodeListEntity;
import io.office.modules.manage.entity.GraiCodeImageEntity;
import io.office.modules.manage.entity.SsccCodeImageEntity;
import io.office.modules.manage.service.BarcodeGenerationService; import io.office.modules.manage.service.BarcodeGenerationService;
import io.office.modules.manage.service.GraiCodeImageService;
import io.office.modules.manage.service.SsccCodeImageService;
import io.office.modules.manage.utils.CheckAICodeUtil; import io.office.modules.manage.utils.CheckAICodeUtil;
import io.office.modules.manage.utils.DateUtils;
import io.office.modules.manage.utils.IdKeysConstant;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
...@@ -19,55 +30,93 @@ import java.util.List; ...@@ -19,55 +30,93 @@ import java.util.List;
public class BarcodeGenerationServiceImpl implements BarcodeGenerationService { public class BarcodeGenerationServiceImpl implements BarcodeGenerationService {
@Autowired @Autowired
private QRcodeDao qRcodeDao; private QRcodeDao qRcodeDao;
@Autowired
private SsccCodeImageService ssccCodeImageService;
@Autowired
private IdWorkService idWorkService;
@Autowired
private GraiCodeImageService graiCodeImageService;
public static final String SEPERATOR = "ñ"; public static final String SEPERATOR = "ñ";
@Value("${prefix_host}") @Value("${prefix_host}")
public String prefix_host; public String prefix_host;
public static final String prefix_url= "barcodegeneration/api/gensvg?type="; public static final String prefix_url = "barcodegeneration/api/gensvg?type=";
@Override @Override
public String createPicture(Object[] param) { public String createPicture(Object[] param) {
String content=""; String aiCodeFlag = "";
String content = "";
String checkCode = "";
String inputCode = "";
//遍历参数数组 //遍历参数数组
for (int i = 0; i < param.length; i++) { for (int i = 0; i < param.length; i++) {
//获取ai标识符 //获取ai标识符
String[] split = param[i].toString().split(","); String[] split = param[i].toString().split(",");
String aiCode=split[0]; if(split.length>2) {
checkCode = split[2];
}
String aiCode = split[0];
inputCode = split[1];
aiCodeFlag = aiCode;
//根据ai标识符查ai详情 //根据ai标识符查ai详情
GS1CodeListEntity fixedLengthResult = qRcodeDao.getFixedLengthResult(aiCode); GS1CodeListEntity fixedLengthResult = qRcodeDao.getFixedLengthResult(aiCode);
//不定长处理 //不定长处理
if(fixedLengthResult.getIsVariable()==1){ if (fixedLengthResult.getIsVariable() == 1) {
if(split[1].trim().length()<=fixedLengthResult.getMaxLength() if (split[1].trim().length() <= fixedLengthResult.getMaxLength()
&&split[1].trim().length()>=fixedLengthResult.getMinLength()){ && split[1].trim().length() >= fixedLengthResult.getMinLength()) {
//content= content+split[0]+split[1]+SEPERATOR;前端拼接过了去掉特殊符号 //content= content+split[0]+split[1]+SEPERATOR;前端拼接过了去掉特殊符号
content= content+split[0]+split[1]; content = content + split[0] + split[1];
}else { } else {
throw new RRException("AI为"+aiCode+" 的信息需要填充"+fixedLengthResult.getMaxLength()+"位数字"); throw new RRException("AI为" + aiCode + " 的信息需要填充" + fixedLengthResult.getMaxLength() + "位数字");
} }
//定长处理 //定长处理
}else if(fixedLengthResult.getIsVariable()==0){ } else if (fixedLengthResult.getIsVariable() == 0) {
if(split[1].trim().length()==fixedLengthResult.getMinLength()){ if (split[1].trim().length() == fixedLengthResult.getMinLength()) {
//是否需要校验码 //是否需要校验码
if(fixedLengthResult.getIsCheck()==1){ if (fixedLengthResult.getIsCheck() == 1) {
content= content+split[0]+split[1]+ CheckAICodeUtil.antoFixCheckCode(split[1]); content = content + split[0] + split[1] + CheckAICodeUtil.antoFixCheckCode(split[1]);
}else{ } else {
content= content+split[0]+split[1]; content = content + split[0] + split[1];
} }
}else { } else {
throw new RRException("AI为"+aiCode+" 的信息需要填充"+fixedLengthResult.getMaxLength()+"位数字"); throw new RRException("AI为" + aiCode + " 的信息需要填充" + fixedLengthResult.getMaxLength() + "位数字");
} }
} }
} }
if(content.lastIndexOf("ñ")==content.length()-1){ if (content.lastIndexOf("ñ") == content.length() - 1) {
content=content.substring(0,content.length()-1); content = content.substring(0, content.length() - 1);
}else if(content.length()>48){ } else if (content.length() > 48) {
throw new RRException("总长度不能超过48位"); throw new RRException("总长度不能超过48位");
} }
String url = ""; String url = "";
if (content.length() > 50) { if (content.length() > 50) {
throw new RRException("最大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"; String id = idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY);
url = prefix_host + prefix_url + "ean128&msg=" + content + "&fmt=png&hrsize=5pt&hrfont=song&qz=0.6cm&wf=1&mw=0.17mm&height=1cm&codeId="+id;
if (StringUtils.isNotBlank(aiCodeFlag) && StrUtil.equals("8003", aiCodeFlag)) {
GraiCodeImageEntity graiCodeImageEntity = new GraiCodeImageEntity();
graiCodeImageEntity.setId(id);
graiCodeImageEntity.setAiCode(aiCodeFlag);
graiCodeImageEntity.setInputCode(inputCode);
graiCodeImageEntity.setCodeImagePath(url);
graiCodeImageEntity.setInputCode(inputCode);
graiCodeImageEntity.setCreateTime(new Date());
graiCodeImageService.save(graiCodeImageEntity);
} else {
//记录生成日志
SsccCodeImageEntity ssccCodeImage = new SsccCodeImageEntity();
ssccCodeImage.setId(id);
ssccCodeImage.setAiCode(aiCodeFlag);
ssccCodeImage.setCheckCode(checkCode);
ssccCodeImage.setInputCode(inputCode);
ssccCodeImage.setCodeImagePath(url);
ssccCodeImage.setCreateTime(new Date());
ssccCodeImageService.save(ssccCodeImage);
}
return url; return url;
} }
...@@ -83,9 +132,9 @@ public class BarcodeGenerationServiceImpl implements BarcodeGenerationService { ...@@ -83,9 +132,9 @@ public class BarcodeGenerationServiceImpl implements BarcodeGenerationService {
public static void main(String[] args) { public static void main(String[] args) {
String content="1122112ñ"; String content = "1122112ñ";
if(content.lastIndexOf("ñ")==content.length()-1){ if (content.lastIndexOf("ñ") == content.length() - 1) {
content=content.substring(0,content.length()-1); content = content.substring(0, content.length() - 1);
} }
System.out.println(content); System.out.println(content);
} }
......
...@@ -5,6 +5,7 @@ import io.office.modules.manage.entity.PartnersEntity; ...@@ -5,6 +5,7 @@ import io.office.modules.manage.entity.PartnersEntity;
import io.office.modules.manage.vo.request.EanUpcEntityVo; import io.office.modules.manage.vo.request.EanUpcEntityVo;
import io.office.modules.manage.vo.response.EanUpcEntityDetailVo; import io.office.modules.manage.vo.response.EanUpcEntityDetailVo;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
......
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.modules.manage.dao.GraiCodeImageDao;
import io.office.modules.manage.entity.GraiCodeImageEntity;
import io.office.modules.manage.service.GraiCodeImageService;
import org.springframework.stereotype.Service;
@Service("graiCodeImageService")
public class GraiCodeImageServiceImpl extends ServiceImpl<GraiCodeImageDao, GraiCodeImageEntity> implements GraiCodeImageService {
}
\ No newline at end of file
...@@ -42,9 +42,13 @@ public class MedicalServiceImpl extends ServiceImpl<MedicalDao, MedicalEntity> i ...@@ -42,9 +42,13 @@ public class MedicalServiceImpl extends ServiceImpl<MedicalDao, MedicalEntity> i
if(params.get("sidx")!=null && StringUtils.isNotBlank(String.valueOf(params.get("sidx")))){ if(params.get("sidx")!=null && StringUtils.isNotBlank(String.valueOf(params.get("sidx")))){
if(String.valueOf(params.get("sidx")).equalsIgnoreCase("type")) { if(String.valueOf(params.get("sidx")).equalsIgnoreCase("type")) {
params.put("sidx","typeid"); params.put("sidx","typeid");
medicalEntityQueryWrapper.orderByAsc("typeid");
} }
} else{
medicalEntityQueryWrapper.orderByAsc("typeid");
} }
IPage<MedicalEntity> page = this.page( IPage<MedicalEntity> page = this.page(
new Query<MedicalEntity>().getPage(params), new Query<MedicalEntity>().getPage(params),
medicalEntityQueryWrapper medicalEntityQueryWrapper
......
...@@ -76,6 +76,7 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements ...@@ -76,6 +76,7 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements
newsEntityQueryWrapper.eq("id", news.getId()); newsEntityQueryWrapper.eq("id", news.getId());
//news.setEditor(user.getUsername()); //news.setEditor(user.getUsername());
news.setLasteditor(user.getUsername()); news.setLasteditor(user.getUsername());
news.setUpdatedate(new Date());
if (news.getCclassid() != null) { if (news.getCclassid() != null) {
news.setClassid(news.getCclassid()); news.setClassid(news.getCclassid());
} }
...@@ -119,6 +120,10 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements ...@@ -119,6 +120,10 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements
@Override @Override
public Page<NewsEntity> selectNewsList(NewsParams newsParams, Page page) { public Page<NewsEntity> selectNewsList(NewsParams newsParams, Page page) {
log.info("查询参数 :{}",newsParams); log.info("查询参数 :{}",newsParams);
if (newsParams.getCclassId() != null&&StringUtils.isNotBlank(newsParams.getCclassId().toString())) {
newsParams.setClassId(newsParams.getCclassId());
}
List<NewsEntity> newsList = this.newsDao.selectNewsList(newsParams, page); List<NewsEntity> newsList = this.newsDao.selectNewsList(newsParams, page);
page.setRecords(newsList); page.setRecords(newsList);
return page; return page;
......
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.modules.manage.dao.SsccCodeImageDao;
import io.office.modules.manage.entity.SsccCodeImageEntity;
import io.office.modules.manage.service.SsccCodeImageService;
import org.springframework.stereotype.Service;
@Service("ssccCodeImageService")
public class SsccCodeImageServiceImpl extends ServiceImpl<SsccCodeImageDao, SsccCodeImageEntity> implements SsccCodeImageService {
}
\ No newline at end of file
...@@ -380,8 +380,12 @@ public class TransferController { ...@@ -380,8 +380,12 @@ public class TransferController {
@RequestMapping("/api/news") @RequestMapping("/api/news")
// @RequiresPermissions("generator:topicnews:list") // @RequiresPermissions("generator:topicnews:list")
public R news() { public R news(String id) {
QueryWrapper<NewsEntity> indexCarouselManageEntityQueryWrapper = new QueryWrapper<>(); QueryWrapper<NewsEntity> indexCarouselManageEntityQueryWrapper = new QueryWrapper<>();
if(StringUtils.isNotBlank(id)) {
indexCarouselManageEntityQueryWrapper.eq("id",id);
}
int count = newsService.count(indexCarouselManageEntityQueryWrapper); int count = newsService.count(indexCarouselManageEntityQueryWrapper);
if (count > 0) { if (count > 0) {
boolean flag = true; boolean flag = true;
......
...@@ -47,8 +47,9 @@ public class IdWorkerUtils { ...@@ -47,8 +47,9 @@ public class IdWorkerUtils {
public static void main(String[] args) { public static void main(String[] args) {
IdWorker idWorker = new IdWorker(0, 1);
System.out.println(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY)); System.out.println(idWorker.nextId());
// System.out.println(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
} }
......
package io.office.modules.manage.utils; package io.office.modules.manage.utils;
import com.sitech.idworkstarter.IdWorkService;
import io.office.common.enumpack.ErrorCodeEnum; import io.office.common.enumpack.ErrorCodeEnum;
import io.office.common.exception.RRException; import io.office.common.exception.RRException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -31,13 +33,16 @@ public class UploadUtils { ...@@ -31,13 +33,16 @@ public class UploadUtils {
@Value("${file.request.prefix}") @Value("${file.request.prefix}")
private String fileRequestPrefix; private String fileRequestPrefix;
@Autowired
IdWorkService idWorkService;
/** /**
* @param file 上传的文件 * @param file 上传的文件
* @return * @return
* @描述:上传文件到临时目录 * @描述:上传文件到临时目录
*/ */
public String fileUpload(MultipartFile file) { public String fileUpload(MultipartFile file) throws IllegalArgumentException {
if (file == null) { if (file == null) {
throw new RRException(ErrorCodeEnum.FILE_IS_NULL); throw new RRException(ErrorCodeEnum.FILE_IS_NULL);
} }
...@@ -47,7 +52,7 @@ public class UploadUtils { ...@@ -47,7 +52,7 @@ public class UploadUtils {
if (!fileDir.exists()) { if (!fileDir.exists()) {
fileDir.mkdirs(); fileDir.mkdirs();
} }
String uuid = IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY); String uuid = idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY);
String dateDirPath = DateUtils.formatDateToString(new Date(), DateUtils.FORMAT4); String dateDirPath = DateUtils.formatDateToString(new Date(), DateUtils.FORMAT4);
String returnFilename = fileRequestPrefix + dateDirPath +"/" +uuid+"-"+ filename; String returnFilename = fileRequestPrefix + dateDirPath +"/" +uuid+"-"+ filename;
filename = fileSavePath + dateDirPath +"/" +uuid+"-"+filename; filename = fileSavePath + dateDirPath +"/" +uuid+"-"+filename;
......
...@@ -51,6 +51,10 @@ public class SysRoleEntity implements Serializable { ...@@ -51,6 +51,10 @@ public class SysRoleEntity implements Serializable {
private Long createUserId; private Long createUserId;
@TableField(exist=false) @TableField(exist=false)
private String createUserName;
@TableField(exist=false)
private List<Long> menuIdList; private List<Long> menuIdList;
/** /**
......
/** /**
* Copyright (c) 2016-2019 人人开源 All rights reserved. * Copyright (c) 2016-2019 人人开源 All rights reserved.
* * <p>
* https://www.renren.io * https://www.renren.io
* * <p>
* 版权所有,侵权必究! * 版权所有,侵权必究!
*/ */
...@@ -17,19 +17,18 @@ import io.office.common.utils.PageUtils; ...@@ -17,19 +17,18 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.Query; import io.office.common.utils.Query;
import io.office.modules.sys.dao.SysRoleDao; import io.office.modules.sys.dao.SysRoleDao;
import io.office.modules.sys.entity.SysRoleEntity; import io.office.modules.sys.entity.SysRoleEntity;
import io.office.modules.sys.entity.SysUserEntity;
import io.office.modules.sys.service.SysRoleMenuService; import io.office.modules.sys.service.SysRoleMenuService;
import io.office.modules.sys.service.SysRoleService; import io.office.modules.sys.service.SysRoleService;
import io.office.modules.sys.service.SysUserRoleService; import io.office.modules.sys.service.SysUserRoleService;
import io.office.modules.sys.service.SysUserService; import io.office.modules.sys.service.SysUserService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* 角色 * 角色
...@@ -47,16 +46,37 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> i ...@@ -47,16 +46,37 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> i
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
String roleName = (String)params.get("roleName"); String roleName = (String) params.get("roleName");
Long createUserId = (Long)params.get("createUserId"); Long createUserId = (Long) params.get("createUserId");
IPage<SysRoleEntity> page = this.page( IPage<SysRoleEntity> page = this.page(
new Query<SysRoleEntity>().getPage(params), new Query<SysRoleEntity>().getPage(params),
new QueryWrapper<SysRoleEntity>() new QueryWrapper<SysRoleEntity>()
.like(StringUtils.isNotBlank(roleName),"role_name", roleName) .like(StringUtils.isNotBlank(roleName), "role_name", roleName)
.eq(createUserId != null,"create_user_id", createUserId) .eq(createUserId != null, "create_user_id", createUserId)
); );
if (CollectionUtils.isNotEmpty(page.getRecords())) {
List<SysRoleEntity> sysRoleEntityList = page.getRecords();
Set<Long> idsList = new HashSet<>();
for (SysRoleEntity sysRoleEntity : sysRoleEntityList) {
idsList.add(sysRoleEntity.getCreateUserId());
}
if (CollectionUtils.isNotEmpty(idsList)) {
List<SysUserEntity> sysUserEntities = sysUserService.listByIds(idsList);
if (CollectionUtils.isNotEmpty(sysUserEntities)) {
for (SysRoleEntity sysRoleEntity : sysRoleEntityList) {
for (SysUserEntity sysUserEntity : sysUserEntities) {
if(sysRoleEntity.getCreateUserId()==sysUserEntity.getCreateUserId()) {
sysRoleEntity.setCreateUserName(sysUserEntity.getUsername());
}
}
}
}
}
page.setRecords(sysRoleEntityList);
}
return new PageUtils(page); return new PageUtils(page);
} }
...@@ -107,7 +127,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> i ...@@ -107,7 +127,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> i
/** /**
* 检查权限是否越权 * 检查权限是否越权
*/ */
private void checkPrems(SysRoleEntity role){ private void checkPrems(SysRoleEntity role) {
//如果不是超级管理员,则需要判断角色的权限是否超过自己的权限 //如果不是超级管理员,则需要判断角色的权限是否超过自己的权限
// if(role.getCreateUserId() == Constant.SUPER_ADMIN){ // if(role.getCreateUserId() == Constant.SUPER_ADMIN){
// return ; // return ;
...@@ -117,7 +137,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> i ...@@ -117,7 +137,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> i
List<Long> menuIdList = sysUserService.queryAllMenuId(role.getCreateUserId()); List<Long> menuIdList = sysUserService.queryAllMenuId(role.getCreateUserId());
//判断是否越权 //判断是否越权
if(!menuIdList.containsAll(role.getMenuIdList())){ if (!menuIdList.containsAll(role.getMenuIdList())) {
throw new RRException("新增角色的权限,已超出你的权限范围"); throw new RRException("新增角色的权限,已超出你的权限范围");
} }
} }
......
...@@ -4,8 +4,8 @@ spring: ...@@ -4,8 +4,8 @@ spring:
druid: druid:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://192.168.0.77:1433;DatabaseName=gs108 url: jdbc:sqlserver://192.168.0.77:1433;DatabaseName=gs108
username: test1 username: wangtian
password: test1 password: wangtian
initial-size: 10 initial-size: 10
max-active: 100 max-active: 100
min-idle: 10 min-idle: 10
...@@ -92,7 +92,7 @@ searchDayCountLimitSwitch: 100 ...@@ -92,7 +92,7 @@ searchDayCountLimitSwitch: 100
#域名 #域名
#域名 #域名
gs1: gs1:
domain: http://192.168.0.77:80 domain: http://www.gs1cn.org
directory: directory:
......
...@@ -73,4 +73,8 @@ logging: ...@@ -73,4 +73,8 @@ logging:
#预览次数控制 #预览次数控制
token.count: 5 token.count: 5
#idwork要初始化的key名称,如果是多个,号隔开(集合)
id.work.idWorkKeyList: id_seq
#需要初始化的大小,单位(个)
id.work.size: 10000
/* 前后端通信相关的配置,注释只允许使用多行方式 */ /* 前后端通信相关的配置,注释只允许使用多行方式 */
{ {
"wordCount": true,
"maximumWords": 100000,
/* 上传图片配置项 */ /* 上传图片配置项 */
"imageActionName": "uploadimage", /* 执行上传图片的action名称 */ "imageActionName": "uploadimage", /* 执行上传图片的action名称 */
"imageFieldName": "upfile", /* 提交的图片表单名称 */ "imageFieldName": "upfile", /* 提交的图片表单名称 */
......
<?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.GraiCodeImageDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.GraiCodeImageEntity" id="graiCodeImageMap">
<result property="id" column="id"/>
<result property="aiCode" column="AI_code"/>
<result property="inputCode" column="input_code"/>
<result property="codeImagePath" column="code_image_path"/>
<result property="createTime" column="create_time"/>
<result property="downloadTime" column="download_time"/>
</resultMap>
</mapper>
\ No newline at end of file
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
ORDER BY ${indexCarouselManage.sidx} ${indexCarouselManage.order} ORDER BY ${indexCarouselManage.sidx} ${indexCarouselManage.order}
</when> </when>
<otherwise> <otherwise>
ORDER BY t.levels desc,t.starttime_index DESC,t.id desc ORDER BY t.id desc,t.levels desc,t.starttime_index DESC
</otherwise> </otherwise>
</choose> </choose>
......
...@@ -120,9 +120,18 @@ ...@@ -120,9 +120,18 @@
<if test="newsParams.status !=null and newsParams.status !=''"> <if test="newsParams.status !=null and newsParams.status !=''">
and status =#{newsParams.status} and status =#{newsParams.status}
</if> </if>
<if test="newsParams.content !=null and newsParams.content !=''">
and title like concat('%',#{newsParams.content},'%')
</if>
<if test="newsParams.editor !=null and newsParams.editor !=''"> <if test="newsParams.editor !=null and newsParams.editor !=''">
and editor like concat('%',#{newsParams.editor},'%') and editor like concat('%',#{newsParams.editor},'%')
</if> </if>
<if test="newsParams.ishead !=null and newsParams.ishead !=''">
and ishead =#{newsParams.ishead}
</if>
<if test="newsParams.classId !=null and newsParams.classId !=''">
and classid =#{newsParams.classId}
</if>
<choose> <choose>
<when test="newsParams.sidx!=null and newsParams.sidx!=''"> <when test="newsParams.sidx!=null and newsParams.sidx!=''">
ORDER BY ${newsParams.sidx} ${newsParams.order} ORDER BY ${newsParams.sidx} ${newsParams.order}
......
<?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.SsccCodeImageDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.SsccCodeImageEntity" id="ssccCodeImageMap">
<result property="id" column="id"/>
<result property="aiCode" column="AI_code"/>
<result property="inputCode" column="input_code"/>
<result property="checkCode" column="check_code"/>
<result property="codeImagePath" column="code_image_path"/>
<result property="createTime" column="create_time"/>
<result property="downloadTime" column="download_time"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.TimescodeChphoneDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.TimescodeChphoneEntity" id="timescodeChphoneMap">
<result property="phone" column="phone"/>
<result property="date" column="date"/>
<result property="times" column="times"/>
<result property="timesValidate" column="times_validate"/>
</resultMap>
</mapper>
\ No newline at end of file
...@@ -8,11 +8,14 @@ ...@@ -8,11 +8,14 @@
package io.renren; package io.renren;
import io.renren.service.DynamicDataSourceTestService; import com.sitech.idworkstarter.IdWorkAutoConfiguration;
import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
/** /**
...@@ -21,18 +24,14 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -21,18 +24,14 @@ import org.springframework.test.context.junit4.SpringRunner;
* @author Mark sunlightcs@gmail.com * @author Mark sunlightcs@gmail.com
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootConfiguration
@SpringBootTest @SpringBootTest
@Import(IdWorkAutoConfiguration.class)
public class DynamicDataSourceTest { public class DynamicDataSourceTest {
@Autowired
private DynamicDataSourceTestService dynamicDataSourceTestService;
@Test
public void test(){
Long id = 1L;
dynamicDataSourceTestService.updateUser(id);
dynamicDataSourceTestService.updateUserBySlave1(id);
dynamicDataSourceTestService.updateUserBySlave2(id);
}
} }
package io.renren; package io.renren;
import io.office.modules.app.utils.JwtUtils;
import com.sitech.idworkstarter.IdWorkAutoConfiguration;
import com.sitech.idworkstarter.IdWorkService;
import io.office.modules.manage.utils.IdKeysConstant;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@Import(IdWorkAutoConfiguration.class)
public class JwtTest { public class JwtTest {
@Resource
IdWorkService idWorkService;
@Test @Test
public void test() { public void test() throws IllegalArgumentException {
for (int i = 0; i < 100; i++) {
System.out.println(idWorkService.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
}
} }
......
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