| | |
| | | @GetMapping("/getEditTemplatePreparation") |
| | | public Result<?> getEditTemplatePreparation(@RequestParam("id") Integer id) { |
| | | StandardTemplate byId = standardTemplateService.getById(id); |
| | | return Result.success("OK", byId.getThing()); |
| | | return Result.success(byId.getThing()); |
| | | } |
| | | |
| | | @ApiOperation(value = "å¤å¶åå§è®°å½æ¨¡æ¿") |
| | |
| | | @GetMapping("/selectOrderManDay") |
| | | public Result<?> selectOrderManDay(Integer id) { |
| | | int day = insProductService.selectOrderManDay(id); |
| | | return Result.success("æå", LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | return Result.success(LocalDateTime.now().plusHours(day).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æ£éªä¸åå
容详æ
") |
| | |
| | | @ApiOperation(value = "éè¿æ£éªå模æ¿idè·åæ£éªå模æ¿å
容") |
| | | @GetMapping("/selectInsOrderTemplateById") |
| | | public Result<?> selectInsOrderTemplateById(Integer id) { |
| | | return Result.success("æå", insOrderTemplateService.selectInsOrderTemplateById(id)); |
| | | return Result.success(insOrderTemplateService.selectInsOrderTemplateById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "å 餿£éªå模æ¿") |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.oa.OAProcess; |
| | | import com.ruoyi.inspect.dto.PushOADto; |
| | |
| | | } |
| | | |
| | | |
| | | @Anonymous |
| | | @ApiOperation(value = "ä¸åæ ¼å¤çOAåè°") |
| | | @RequestMapping(value = "/callback", produces = "text/plain") |
| | | public String unqualifiedHandlerOACallback(String data){ |
| | |
| | | JSONArray objects = JSONArray.parseArray(JSONObject.toJSONString(o)); |
| | | unqualifiedHandlerService.unqualifiedHandlerOACallback(oaWorkId, checkResult,objects); |
| | | } catch (Exception e) { |
| | | System.out.println(e.getMessage()); |
| | | log.error("oaåè°å¤±è´¥: " + e.getMessage()); |
| | | msg = OAProcess.oaReturnMsg(1, "oaåè°å¤±è´¥: " + e.getMessage()); |
| | | } |
| | | System.out.println("oaåè°è¿åç»æ========>" + msg); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.*; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.common.annotation.PersonalScope; |
| | | import com.ruoyi.inspect.dto.InsPlaceOrderDto; |
| | | import com.ruoyi.inspect.dto.SampleProductDto; |
| | | import com.ruoyi.inspect.pojo.InsOrder; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | |
| | | @ApiOperation(value = "åæææ£éªæ¥è¯¢æ£éªä¸") |
| | | @GetMapping("/getIfsByStateOne") |
| | | // @PreAuthorize("@ss.hasPermi('business:order')") |
| | | // @PersonalScope(permsName = "business:order", objectName = IfsInventoryQuantityDto.class, paramName = "createUser") |
| | | public Result getIfsByStateOne(Page page, IfsInventoryQuantityDto ifsInventoryQuantityDto){ |
| | | return Result.success(rawMaterialOrderService.getIfsByStateOne(page, ifsInventoryQuantityDto)); |
| | | } |
| | |
| | | @ApiOperation(value = "éè¿åæææ£éªå模æ¿idè·åæ£éªå模æ¿å
容") |
| | | @GetMapping("/selectRawMaterOrderTemplateById") |
| | | public Result<?> selectRawMaterOrderTemplateById(Integer id) { |
| | | return Result.success("æå", rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id)); |
| | | return Result.success(rawMaterialOrderTemplateService.selectRawMaterOrderTemplateById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤åæææ£éªå模æ¿") |
| | |
| | | @ApiOperation(value = "è·åé产ä¸é¾æ£æµæ°æ®") |
| | | @GetMapping("/getIndustryChain") |
| | | public Result<?> getIndustryChain(Integer id) { |
| | | return Result.success("æå", rawMaterialOrderService.getIndustryChain(id)); |
| | | return Result.success(rawMaterialOrderService.getIndustryChain(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | return null; |
| | | }); |
| | | // todo: å 餿°éé鿬¡æ° |
| | | // String key = "frequency" + ":" + entrustCode + ":*"; |
| | | // RedisUtil.delsLike(key); |
| | | |
| | | // æäº¤çææ¥å |
| | | this.generateReport(orderId); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // todo: æåæ½æ ·æ·»å åæ ¼ç¶æ |
| | | // æåæ½æ ·æ·»å åæ ¼ç¶æ |
| | | // 夿æ¯å¦ææ½æ ·ä¿¡æ¯ |
| | | if (order.getQuarterItemId() != null) { |
| | | // 夿æ¯å¦æä¸åæ ¼ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.annotation; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * ä»
çææé |
| | | * |
| | | */ |
| | | @Target(ElementType.METHOD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface PersonalScope { |
| | | |
| | | /** |
| | | * æéæ è¯åç§° |
| | | * @return |
| | | */ |
| | | String permsName(); |
| | | |
| | | /** |
| | | * 对象åç§° |
| | | * @return |
| | | */ |
| | | Class objectName(); |
| | | |
| | | /** |
| | | * åæ°åç§° |
| | | * @return |
| | | */ |
| | | String paramName(); |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * Treeselectæ ç»æå®ä½ç±» |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class TreeSelect implements Serializable |
| | |
| | | |
| | | /** èç¹åç§° */ |
| | | private String label; |
| | | |
| | | /** æ¯å¦å¯ä»¥éæ©ä»
çæ, 0:å¦, 1:æ¯ */ |
| | | private Integer isRersonalButton; |
| | | |
| | | /** èç¹ç¦ç¨ */ |
| | | private boolean disabled = false; |
| | |
| | | { |
| | | this.id = menu.getMenuId(); |
| | | this.label = menu.getMenuName(); |
| | | this.isRersonalButton = menu.geIsRersonalButton(); |
| | | this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); |
| | | } |
| | | |
| | |
| | | { |
| | | this.children = children; |
| | | } |
| | | |
| | | public Integer geIsRersonalButton() |
| | | { |
| | | return isRersonalButton; |
| | | } |
| | | |
| | | public void setIsRersonalButton(Integer isRersonalButton) |
| | | { |
| | | this.isRersonalButton = isRersonalButton; |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * èåæé表 sys_menu |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysMenu extends BaseEntity |
| | |
| | | |
| | | /** èå徿 */ |
| | | private String icon; |
| | | |
| | | /** æ¯å¦å¯ä»¥éæ©ä»
çæ, 0:å¦, 1:æ¯ */ |
| | | private Integer isRersonalButton; |
| | | |
| | | /** åèå */ |
| | | private List<SysMenu> children = new ArrayList<SysMenu>(); |
| | |
| | | this.icon = icon; |
| | | } |
| | | |
| | | public Integer geIsRersonalButton() |
| | | { |
| | | return isRersonalButton; |
| | | } |
| | | |
| | | public void setIsRersonalButton(Integer isRersonalButton) |
| | | { |
| | | this.isRersonalButton = isRersonalButton; |
| | | } |
| | | |
| | | public List<SysMenu> getChildren() |
| | | { |
| | | return children; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.framework.aspectj; |
| | | |
| | | import com.ruoyi.common.annotation.PersonalScope; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.domain.vo.SysRoleVo; |
| | | import com.ruoyi.system.mapper.SysRoleMenuMapper; |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.aspectj.lang.annotation.Pointcut; |
| | | import org.aspectj.lang.reflect.MethodSignature; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ä»
çææé |
| | | * |
| | | * @Author zhuo |
| | | * @Date 2025/2/20 |
| | | */ |
| | | @Aspect |
| | | @Component |
| | | public class PersonalScopeAspect { |
| | | |
| | | @Autowired |
| | | private SysRoleMenuMapper sysRoleMenuMapper; |
| | | |
| | | @Pointcut("@annotation(com.ruoyi.common.annotation.PersonalScope)") |
| | | public void dataScopePointCut() { |
| | | } |
| | | |
| | | @Before("dataScopePointCut()") |
| | | public void doBefore(JoinPoint point) throws Throwable { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | |
| | | // è·åç®æ æ¹æ³çç¾å |
| | | MethodSignature signature = (MethodSignature) point.getSignature(); |
| | | // è·åç®æ æ¹æ³ä¸ç注解 |
| | | PersonalScope annotation = signature.getMethod().getAnnotation(PersonalScope.class); |
| | | |
| | | // è·åæé夿æ¯å¦æ¯ä»
çæ |
| | | SysRoleVo sysRoleVo = sysRoleMenuMapper.selectRoleMenu(annotation.permsName(), userId); |
| | | |
| | | //没æä»
çææéè·³è¿ |
| | | if (sysRoleVo == null || sysRoleVo.getIsRersonal() == null || !sysRoleVo.getIsRersonal().equals(1)) { |
| | | return; |
| | | } |
| | | |
| | | // è·åæ¹é¢ä¸ææç对象 |
| | | Object[] args = point.getArgs(); |
| | | for (Object arg : args) { |
| | | // å¾ªç¯æ¥æ¾å¹é
ç对象 |
| | | if (arg.getClass().equals(annotation.objectName())) { |
| | | Class<?> argClass = arg.getClass(); |
| | | // æ¥æ¾éè¦å¡«å
çåæ®µ |
| | | Field declaredField = getField(argClass, annotation.paramName()); |
| | | declaredField.setAccessible(true); |
| | | // æ·»å ç¨æ·Id |
| | | declaredField.set(arg, userId.intValue()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // é彿¥æ¾å段 |
| | | private Field getField(Class<?> clazz, String fieldName) throws NoSuchFieldException { |
| | | // ä»å½åç±»å¼å§æ¥æ¾å段 |
| | | try { |
| | | return clazz.getDeclaredField(fieldName); |
| | | } catch (NoSuchFieldException e) { |
| | | // 妿å½åç±»æ²¡ææ¾å°ï¼æ£æ¥ç¶ç±» |
| | | Class<?> superClass = clazz.getSuperclass(); |
| | | if (superClass != null) { |
| | | return getField(superClass, fieldName); |
| | | } else { |
| | | throw e; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | .authorizeHttpRequests((requests) -> { |
| | | permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll()); |
| | | // 对äºç»å½login 注åregister éªè¯ç captchaImage å
许å¿åè®¿é® |
| | | requests.antMatchers("/login", "/register", "/captchaImage", "/unqualifiedHandler/callback").permitAll() |
| | | requests.antMatchers("/login", "/register", "/captchaImage").permitAll() |
| | | // éæèµæºï¼å¯å¿åè®¿é® |
| | | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() |
| | | .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.system.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2025/2/20 |
| | | */ |
| | | @Data |
| | | public class SysRoleVo { |
| | | |
| | | @ApiModelProperty("æéæ è¯") |
| | | private String perms; |
| | | |
| | | @ApiModelProperty("èååç§°") |
| | | private String menuName; |
| | | |
| | | @ApiModelProperty("æ¯å¦ä»
çæ, 0: å¦, 1:æ¯") |
| | | private Integer isRersonal; |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.vo.SysRoleVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * è§è²ä¸èåå
³è表 æ°æ®å± |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface SysRoleMenuMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢èåä½¿ç¨æ°é |
| | | * |
| | | * |
| | | * @param menuId èåID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿è§è²IDå é¤è§è²åèåå
³è |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤è§è²èåå
³èä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éæ°å¢è§è²èåä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param roleMenuList è§è²èåå表 |
| | | * @return ç»æ |
| | | */ |
| | | public int batchRoleMenu(List<SysRoleMenu> roleMenuList); |
| | | |
| | | /** |
| | | * æ ¹æ®æéæ è¯åç¨æ·idæ¥è¯¢æé |
| | | * @param permsName |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | SysRoleVo selectRoleMenu(@Param("permsName") String permsName, @Param("userId") Long userId); |
| | | } |
| | |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="isRersonalButton" column="is_rersonal_button" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectMenuVo"> |
| | | select menu_id, menu_name, parent_id, order_num, path, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time |
| | | select menu_id, menu_name, parent_id, order_num, path, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time, is_rersonal_button |
| | | from sys_menu |
| | | </sql> |
| | | |
| | |
| | | </select> |
| | | |
| | | <select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult"> |
| | | select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time |
| | | select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.is_rersonal_button |
| | | from sys_menu m |
| | | left join sys_role_menu rm on m.menu_id = rm.menu_id |
| | | left join sys_user_role ur on rm.role_id = ur.role_id |
| | |
| | | <if test="icon !=null and icon != ''">icon = #{icon},</if> |
| | | <if test="remark != null and remark != ''">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="isRersonalButton != null and isRersonalButton != ''">is_rersonal_button = #{isRersonalButton},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where menu_id = #{menuId} |
| | |
| | | <result property="roleId" column="role_id" /> |
| | | <result property="menuId" column="menu_id" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="checkMenuExistRole" resultType="Integer"> |
| | | select count(1) from sys_role_menu where menu_id = #{menuId} |
| | | </select> |
| | | |
| | | <delete id="deleteRoleMenuByRoleId" parameterType="Long"> |
| | | <!-- æ ¹æ®æéæ è¯åç¨æ·idæ¥è¯¢æé --> |
| | | <select id="selectRoleMenu" resultType="com.ruoyi.system.domain.vo.SysRoleVo"> |
| | | select sm.perms, |
| | | sm.menu_name, |
| | | srm.is_rersonal |
| | | from sys_role_menu srm |
| | | left join sys_menu sm on sm.menu_id = srm.menu_id |
| | | left join sys_user_role sur on srm.role_id = sur.role_id |
| | | where sm.perms = #{permsName} |
| | | and sur.user_id = #{userId} |
| | | group by sm.menu_id |
| | | </select> |
| | | |
| | | <delete id="deleteRoleMenuByRoleId" parameterType="Long"> |
| | | delete from sys_role_menu where role_id=#{roleId} |
| | | </delete> |
| | | |
| | | |
| | | <delete id="deleteRoleMenu" parameterType="Long"> |
| | | delete from sys_role_menu where role_id in |
| | | <foreach collection="array" item="roleId" open="(" separator="," close=")"> |
| | | #{roleId} |
| | | </foreach> |
| | | </foreach> |
| | | </delete> |
| | | |
| | | |
| | | <insert id="batchRoleMenu"> |
| | | insert into sys_role_menu(role_id, menu_id) values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | (#{item.roleId},#{item.menuId}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | </mapper> |
| | | |
| | | </mapper> |