已添加9个文件
已重命名1个文件
已修改41个文件
已删除45个文件
| | |
| | | <artifactId>knife4j-spring-boot-starter</artifactId>
|
| | | <version>3.0.3</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>cn.hutool</groupId>
|
| | | <artifactId>hutool-all</artifactId>
|
| | | <version>5.8.16</version>
|
| | | </dependency>
|
| | | <!-- SpringBoot æ ¸å¿å
-->
|
| | | <dependency>
|
| | | <groupId>org.springframework.boot</groupId>
|
| | |
| | | <groupId>com.baomidou</groupId>
|
| | | <artifactId>mybatis-plus-boot-starter</artifactId>
|
| | | <version>${mybatis-plus.version}</version>
|
| | | <exclusions>
|
| | | <exclusion>
|
| | | <groupId>com.github.jsqlparser</groupId>
|
| | | <artifactId>jsqlparser</artifactId>
|
| | | </exclusion>
|
| | | </exclusions>
|
| | | </dependency>
|
| | |
|
| | | <!--mybatis-plus代ç çæå¨-->
|
| | |
| | | if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
|
| | | {
|
| | | String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext());
|
| | | dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), controllerDataScope.userAlias(), permission);
|
| | | dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), controllerDataScope.userAlias(), controllerDataScope.tenantIdFelid(), permission);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | * @param user ç¨æ·
|
| | | * @param deptAlias é¨é¨å«å
|
| | | * @param userAlias ç¨æ·å«å
|
| | | * @param tenantIdFelid ç§æ·idåæ®µå
|
| | | * @param permission æéå符
|
| | | */
|
| | | public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission)
|
| | | public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias,String tenantIdFelid, String permission)
|
| | | {
|
| | | StringBuilder sqlString = new StringBuilder();
|
| | | List<String> conditions = new ArrayList<String>();
|
| | |
| | | if (StringUtils.isNotBlank(userAlias))
|
| | | {
|
| | | sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
|
| | | }else if(StringUtils.isNotBlank(tenantIdFelid)){
|
| | | sqlString.append(StringUtils.format(" OR {}.tenant_id = {} ", tenantIdFelid, user.getTenantId()));
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | public String userAlias() default "";
|
| | |
|
| | | /**
|
| | | * ç§æ·idåæ®µå
|
| | | * @return
|
| | | */
|
| | | public String tenantIdFelid() default "";
|
| | |
|
| | | /**
|
| | | * æéå符ï¼ç¨äºå¤ä¸ªè§è²å¹é
符åè¦æ±çæéï¼é»è®¤æ ¹æ®æé注解@ssè·åï¼å¤ä¸ªæéç¨éå·åé弿¥
|
| | | */
|
| | | public String permission() default "";
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.mapper.ProductionOrderMapper; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | import com.ruoyi.production.service.ProductionOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/11/26 14:21 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "ç产订å") |
| | | @RequestMapping("/productionOrder") |
| | | public class ProductionOrderController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ProductionOrderService productionOrderService; |
| | | |
| | | @Autowired |
| | | private ProductionOrderMapper productionOrderMapper; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "ç产订å-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("ç产订å-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, ProductionOrder productionOrder) { |
| | | return productionOrderService.listPage(page, productionOrder); |
| | | } |
| | | |
| | | @PostMapping("/addProductionOrder") |
| | | @Log(title = "ç产订å-æ°å¢", businessType = BusinessType.INSERT) |
| | | @ApiOperation("ç产订å-æ°å¢") |
| | | public AjaxResult addProductionOrder(@RequestBody ProductionOrder productionOrder) { |
| | | String scdd = OrderUtils.countTodayByCreateTime(productionOrderMapper, "SCDD"); |
| | | productionOrder.setOrderNo(scdd); |
| | | return AjaxResult.success(productionOrderService.save(productionOrder)); |
| | | } |
| | | |
| | | @PostMapping("/updateProductionOrder") |
| | | @Log(title = "ç产订å-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("ç产订å-ä¿®æ¹") |
| | | public AjaxResult updateProductionOrder(@RequestBody ProductionOrder productionOrder) { |
| | | return AjaxResult.success(productionOrderService.updateById(productionOrder)); |
| | | } |
| | | |
| | | @DeleteMapping("/deleteProductionOrder") |
| | | @Log(title = "ç产订å-å é¤", businessType = BusinessType.DELETE) |
| | | @ApiOperation("ç产订å-å é¤") |
| | | public AjaxResult deleteProductionOrder(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("è¯·ä¼ å
¥è¦å é¤çID"); |
| | | return AjaxResult.success(productionOrderService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * @param response |
| | | */ |
| | | @PostMapping("/export") |
| | | @ApiOperation("ç产管ç-ç产订å-导åº") |
| | | @Log(title = "ç产订å-导åº", businessType = BusinessType.EXPORT) |
| | | public void export(HttpServletResponse response) { |
| | | productionOrderService.export(response); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportOne") |
| | | @ApiOperation("ç产管ç-ç产派工-导åº") |
| | | @Log(title = "ç产订å-导åº", businessType = BusinessType.EXPORT) |
| | | public void exportOne(HttpServletResponse response) { |
| | | productionOrderService.exportOne(response); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¡¨åæ |
| | | * @param startDate |
| | | * @param endDate |
| | | * @return |
| | | */ |
| | | @GetMapping("/reportAnalysis") |
| | | @ApiOperation("ç产管ç-æ¥è¡¨åæ") |
| | | @Log(title = "æ¥è¡¨åæ", businessType = BusinessType.OTHER) |
| | | public AjaxResult reportAnalysis(String startDate,String endDate){ |
| | | return AjaxResult.success(productionOrderService.reportAnalysis(startDate, endDate)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.SalesLedgerProductionAccountingDto; |
| | | import com.ruoyi.production.pojo.SalesLedgerProductionAccounting; |
| | | import com.ruoyi.production.service.impl.SalesLedgerProductionAccountingServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementDto; |
| | | import com.ruoyi.production.dto.ProcessSchedulingDto; |
| | | import com.ruoyi.production.dto.ProductionDispatchAddDto; |
| | | import com.ruoyi.production.dto.SalesLedgerSchedulingDto; |
| | | import com.ruoyi.production.dto.SalesLedgerSchedulingProcessDto; |
| | | import com.ruoyi.production.service.impl.SalesLedgerSchedulingServiceImpl; |
| | | import io.swagger.annotations.Api; |
| | |
| | | private SalesLedgerSchedulingServiceImpl salesLedgerSchedulingService; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "ç产管ç-ç产订å-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @ApiOperation("ç产管ç-ç产订å-å页æ¥è¯¢") |
| | | public AjaxResult listPage(Page page, SalesLedgerSchedulingDto salesLedgerSchedulingDto) { |
| | | IPage<SalesLedgerSchedulingDto> result = salesLedgerSchedulingService.listPage(page,salesLedgerSchedulingDto); |
| | | return AjaxResult.success(result); |
| | | } |
| | | // @GetMapping("/listPage") |
| | | // @Log(title = "ç产管ç-ç产订å-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | // @ApiOperation("ç产管ç-ç产订å-å页æ¥è¯¢") |
| | | // public AjaxResult listPage(Page page, SalesLedgerSchedulingDto salesLedgerSchedulingDto) { |
| | | // IPage<SalesLedgerSchedulingDto> result = salesLedgerSchedulingService.listPage(page,salesLedgerSchedulingDto); |
| | | // return AjaxResult.success(result); |
| | | // } |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * @param response |
| | | */ |
| | | @PostMapping("/export") |
| | | @ApiOperation("ç产管ç-ç产订å-导åº") |
| | | public void export(HttpServletResponse response) { |
| | | salesLedgerSchedulingService.export(response); |
| | | } |
| | | // /** |
| | | // * å¯¼åº |
| | | // * @param response |
| | | // */ |
| | | // @PostMapping("/export") |
| | | // @ApiOperation("ç产管ç-ç产订å-导åº") |
| | | // public void export(HttpServletResponse response) { |
| | | // salesLedgerSchedulingService.export(response); |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * @param response |
| | | */ |
| | | @PostMapping("/exportOne") |
| | | @ApiOperation("ç产管ç-ç产派工-导åº") |
| | | public void exportOne(HttpServletResponse response) { |
| | | salesLedgerSchedulingService.exportOne(response); |
| | | } |
| | | |
| | | @PostMapping("/productionDispatch") |
| | | @Log(title = "ç产管ç-ç产订å-ç产派工", businessType = BusinessType.INSERT) |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @Excel(name = "å¾
ææ°é") |
| | | private BigDecimal daiNum; |
| | | |
| | | @ApiModelProperty(value = "éå®äº§åID") |
| | | private Long salesLedgerProductId; |
| | | |
| | | @ApiModelProperty(value = "éå®å°è´¦ID") |
| | | private Long salesLedgerId; |
| | | |
| | | /** |
| | | * éå®ååå· |
| | | * ç产订åå· |
| | | */ |
| | | @Excel(name = "éå®ååå·") |
| | | @ApiModelProperty(value = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | /** |
| | | * 客æ·ååå· |
| | | */ |
| | | @Excel(name = "客æ·ååå·") |
| | | @ApiModelProperty(value = "客æ·ååå·") |
| | | private String customerContractNo; |
| | | |
| | | /** |
| | | * 项ç®åç§° |
| | | */ |
| | | @Excel(name = "项ç®åç§°") |
| | | @ApiModelProperty(value = "项ç®åç§°") |
| | | private String projectName; |
| | | |
| | | /** |
| | | * å½å
¥æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å½å
¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "å½å
¥æ¥æ") |
| | | private Date entryDate; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥æ¥æå¼å§") |
| | | private String entryDateStart; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥æ¥æç»æ") |
| | | private String entryDateEnd; |
| | | |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | | @Excel(name = "客æ·åç§°") |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Excel(name = "ç产订åå·") |
| | | private String orderNo; |
| | | |
| | | /** |
| | | * 产å大类 |
| | | */ |
| | | @Excel(name = "产å大类") |
| | | @ApiModelProperty(value = "产å大类") |
| | | private String productCategory; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @Excel(name = "è§æ ¼åå·") |
| | | @ApiModelProperty(value = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @Excel(name = "åä½") |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | @Excel(name = "æ°é") |
| | | @ApiModelProperty(value = "æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * æäº§æ°é |
| | | * 订åç¶æ |
| | | */ |
| | | @Excel(name = "æäº§æ°é") |
| | | @ApiModelProperty(value = "æäº§æ°é") |
| | | private BigDecimal schedulingNum; |
| | | @Excel(name = "订åç¶æ") |
| | | @TableField(exist = false) |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | private Long tenantId; |
| | | @ApiModelProperty(value = "å®å·¥æ°é") |
| | | @TableField(exist = false) |
| | | private BigDecimal successNum; |
| | | |
| | | /** |
| | | * å½å
¥æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @Excel(name = "å½å
¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private LocalDate registerDate; |
| | | |
| | | /** |
| | | * å½å
¥äºº |
| | | */ |
| | | @Excel(name = "å½å
¥äºº") |
| | | private String createBy; |
| | | |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @ApiModel |
| | | public class ProcessSchedulingDto { |
| | | |
| | | /** |
| | | * å£å³åç±» |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * æè |
| | | */ |
| | | private String loss; |
| | | |
| | | /** |
| | | * é¢ç¨ |
| | | */ |
| | | private String receive; |
| | | |
| | | private Long id; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value = "éå®å°è´¦ID") |
| | | private Long salesLedgerId; |
| | | |
| | | @ApiModelProperty(value = "éå®äº§åID") |
| | | @ApiModelProperty(value = "ç产订åID") |
| | | private Long salesLedgerProductId; |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @ApiModel |
| | | public class SalesLedgerProductDto { |
| | | |
| | | /** |
| | | * éå®ååå· |
| | | */ |
| | | @Excel(name = "éå®ååå·") |
| | | @ApiModelProperty(value = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | /** |
| | | * 客æ·ååå· |
| | | */ |
| | | @Excel(name = "客æ·ååå·") |
| | | @ApiModelProperty(value = "客æ·ååå·") |
| | | private String customerContractNo; |
| | | |
| | | /** |
| | | * 项ç®åç§° |
| | | */ |
| | | @Excel(name = "项ç®åç§°") |
| | | @ApiModelProperty(value = "项ç®åç§°") |
| | | private String projectName; |
| | | // /** |
| | | // * éå®ååå· |
| | | // */ |
| | | // @Excel(name = "éå®ååå·") |
| | | // @ApiModelProperty(value = "éå®ååå·") |
| | | // private String salesContractNo; |
| | | // |
| | | // /** |
| | | // * 客æ·ååå· |
| | | // */ |
| | | // @Excel(name = "客æ·ååå·") |
| | | // @ApiModelProperty(value = "客æ·ååå·") |
| | | // private String customerContractNo; |
| | | // |
| | | // /** |
| | | // * 项ç®åç§° |
| | | // */ |
| | | // @Excel(name = "项ç®åç§°") |
| | | // @ApiModelProperty(value = "项ç®åç§°") |
| | | // private String projectName; |
| | | |
| | | |
| | | /** |
| | | * 客æ·åç§° |
| | | * ç产订åå· |
| | | */ |
| | | @Excel(name = "客æ·åç§°") |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String customerName; |
| | | @Excel(name = "ç产订åå·") |
| | | @ApiModelProperty(value = "ç产订åå·") |
| | | private String orderNo; |
| | | |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ApiModel |
| | | public class SalesLedgerSchedulingProcessDto { |
| | | |
| | | @ApiModelProperty(value = "éå®äº§åID") |
| | | @ApiModelProperty(value = "ç产订åID") |
| | | private Long salesLedgerProductId; |
| | | |
| | | @ApiModelProperty(value = "éå®å°è´¦ID") |
| | | private Long salesLedgerId; |
| | | |
| | | @ApiModelProperty(value = "å¼å§æ¶é´") |
| | | private String entryDateStart; |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * éå®ååå· |
| | | * ç产订åå· |
| | | */ |
| | | @Excel(name = "éå®ååå·") |
| | | @ApiModelProperty(value = "éå®ååå·") |
| | | private String salesContractNo; |
| | | |
| | | /** |
| | | * 客æ·ååå· |
| | | */ |
| | | @Excel(name = "客æ·ååå·") |
| | | @ApiModelProperty(value = "客æ·ååå·") |
| | | private String customerContractNo; |
| | | |
| | | /** |
| | | * 项ç®åç§° |
| | | */ |
| | | @Excel(name = "项ç®åç§°") |
| | | @ApiModelProperty(value = "项ç®åç§°") |
| | | private String projectName; |
| | | @Excel(name = "ç产订åå·") |
| | | @ApiModelProperty(value = "ç产订åå·") |
| | | private String orderNo; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "æ´¾å·¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "æ´¾å·¥æ¥æ") |
| | | private Date schedulingDate; |
| | | |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | | @Excel(name = "客æ·åç§°") |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | |
| | | /** |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/11/26 14:18 |
| | | */ |
| | | public interface ProductionOrderMapper extends BaseMapper<ProductionOrder> { |
| | | Double selectFinishProduced(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime); |
| | | |
| | | Double selectTotalWorkhours(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime); |
| | | |
| | | Map<String,Object> selectProductData(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime); |
| | | |
| | | List<Map<String,Object>> selectWorkhoursReport(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime); |
| | | } |
| | |
| | | import com.ruoyi.production.pojo.SalesLedgerScheduling; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | IPage<SalesLedgerSchedulingProcessDto> listPageProcess(Page page,@Param("salesLedgerDto") SalesLedgerSchedulingProcessDto salesLedgerSchedulingDto); |
| | | |
| | | Double selectTobeProduced(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/11/26 14:15 |
| | | */ |
| | | @Data |
| | | @TableName("production_order") |
| | | public class ProductionOrder { |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥æ¥æå¼å§") |
| | | @TableField(exist = false) |
| | | private String entryDateStart; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥æ¥æç»æ") |
| | | @TableField(exist = false) |
| | | private String entryDateEnd; |
| | | |
| | | /** |
| | | * ç产订åå· |
| | | */ |
| | | @Excel(name = "ç产订åå·") |
| | | @ApiModelProperty(value = "ç产订åå·") |
| | | private String orderNo; |
| | | |
| | | /** |
| | | * 产å大类 |
| | | */ |
| | | @Excel(name = "产å大类") |
| | | @ApiModelProperty(value = "产å大类") |
| | | private String productCategory; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | @Excel(name = "è§æ ¼åå·") |
| | | @ApiModelProperty(value = "è§æ ¼åå·") |
| | | private String specificationModel; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | @Excel(name = "åä½") |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | |
| | | /** |
| | | * æ°é |
| | | */ |
| | | @Excel(name = "æ°é") |
| | | @ApiModelProperty(value = "æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * 订åç¶æ |
| | | */ |
| | | @Excel(name = "订åç¶æ") |
| | | @TableField(exist = false) |
| | | private String status = "æªå®æ"; |
| | | |
| | | /** |
| | | * æäº§æ°é |
| | | */ |
| | | @Excel(name = "æäº§æ°é") |
| | | @ApiModelProperty(value = "æäº§æ°é") |
| | | @TableField(exist = false) |
| | | private BigDecimal schedulingNum; |
| | | |
| | | |
| | | /** |
| | | * å®å·¥æ°é |
| | | */ |
| | | @Excel(name = "å®å·¥æ°é") |
| | | @ApiModelProperty(value = "å®å·¥æ°é") |
| | | @TableField(exist = false) |
| | | private BigDecimal successNum = BigDecimal.ZERO; |
| | | |
| | | /** |
| | | * å½å
¥æ¥æ |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @Excel(name = "å½å
¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "å½å
¥æ¥æ") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate registerDate; |
| | | |
| | | /** |
| | | * å½å
¥äºº |
| | | */ |
| | | @Excel(name = "å½å
¥äºº") |
| | | @ApiModelProperty(value = "å½å
¥äºº") |
| | | private String createBy; |
| | | |
| | | /** |
| | | * å建è
|
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * ä¿®æ¹è
|
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¶é´ |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | } |
| | |
| | | private Long salesLedgerId; |
| | | |
| | | /** |
| | | * éå®äº§åid |
| | | * ç产订åid |
| | | */ |
| | | private Long salesLedgerProductId; |
| | | |
| | |
| | | private Long salesLedgerId; |
| | | |
| | | /** |
| | | * éå®äº§åid |
| | | * ç产订åid |
| | | */ |
| | | private Long salesLedgerProductId; |
| | | |
| | |
| | | * å·¥åº |
| | | */ |
| | | private String process; |
| | | |
| | | /** |
| | | * å£å³åç±» |
| | | */ |
| | | private String type; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * æè |
| | | */ |
| | | private String loss; |
| | | |
| | | /** |
| | | * é¢ç¨ |
| | | */ |
| | | private String receive; |
| | | /** |
| | | * æäº§æ¥æ |
| | | */ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.time.LocalDate; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/11/26 14:19 |
| | | */ |
| | | public interface ProductionOrderService extends IService<ProductionOrder> { |
| | | AjaxResult listPage(Page page, ProductionOrder productionOrder); |
| | | |
| | | void export(HttpServletResponse response); |
| | | |
| | | void exportOne(HttpServletResponse response); |
| | | |
| | | Map<String,Object> reportAnalysis(String startDate, String endDate); |
| | | } |
| | |
| | | |
| | | int processScheduling(List<ProcessSchedulingDto> processSchedulingDto); |
| | | |
| | | void exportOne(HttpServletResponse response); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.DaiDto; |
| | | import com.ruoyi.production.dto.SalesLedgerWorkDto; |
| | | import com.ruoyi.production.mapper.ProductionOrderMapper; |
| | | import com.ruoyi.production.mapper.SalesLedgerSchedulingMapper; |
| | | import com.ruoyi.production.mapper.SalesLedgerWorkMapper; |
| | | import com.ruoyi.production.pojo.ProductionOrder; |
| | | import com.ruoyi.production.pojo.SalesLedgerScheduling; |
| | | import com.ruoyi.production.pojo.SalesLedgerWork; |
| | | import com.ruoyi.production.service.ProductionOrderService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | | * @date : 2025/11/26 14:20 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ProductionOrderServiceImpl extends ServiceImpl<ProductionOrderMapper, ProductionOrder> implements ProductionOrderService { |
| | | |
| | | @Autowired |
| | | private ProductionOrderMapper productionOrderMapper; |
| | | |
| | | @Autowired |
| | | private SalesLedgerWorkMapper salesLedgerWorkMapper; |
| | | |
| | | @Autowired |
| | | private SalesLedgerSchedulingMapper salesLedgerSchedulingMapper; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, ProductionOrder productionOrder) { |
| | | LambdaQueryWrapper<ProductionOrder> productionOrderLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(productionOrder != null){ |
| | | if(StringUtils.isNotEmpty(productionOrder.getOrderNo())){ |
| | | productionOrderLambdaQueryWrapper.like(ProductionOrder::getOrderNo, productionOrder.getOrderNo()); |
| | | } |
| | | if(StringUtils.isNotEmpty(productionOrder.getProductCategory())){ |
| | | productionOrderLambdaQueryWrapper.like(ProductionOrder::getProductCategory, productionOrder.getProductCategory()); |
| | | } |
| | | if(StringUtils.isNotEmpty(productionOrder.getEntryDateStart()) && StringUtils.isNotEmpty(productionOrder.getEntryDateEnd())){ |
| | | productionOrderLambdaQueryWrapper.ge(ProductionOrder::getRegisterDate, productionOrder.getEntryDateStart()) |
| | | .le(ProductionOrder::getRegisterDate, productionOrder.getEntryDateEnd()); |
| | | } |
| | | |
| | | } |
| | | IPage<ProductionOrder> list = productionOrderMapper.selectPage(page,productionOrderLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty(list.getRecords())){ |
| | | return AjaxResult.success(list); |
| | | } |
| | | Set<Long> collect = list.getRecords().stream().map(ProductionOrder::getId).collect(Collectors.toSet()); |
| | | // è·åæäº§æ°é |
| | | LambdaQueryWrapper<SalesLedgerScheduling> salesLedgerSchedulingLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerSchedulingLambdaQueryWrapper.in(SalesLedgerScheduling::getSalesLedgerProductId, collect); |
| | | List<SalesLedgerScheduling> salesLedgerSchedulings = salesLedgerSchedulingMapper.selectList(salesLedgerSchedulingLambdaQueryWrapper); |
| | | // 计ç®å®å·¥æ°é |
| | | LambdaQueryWrapper<SalesLedgerWork> salesLedgerWorkLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerWorkLambdaQueryWrapper.in(SalesLedgerWork::getSalesLedgerProductId, collect) |
| | | .ne(SalesLedgerWork::getStatus, 1); |
| | | List<SalesLedgerWork> salesLedgerWorks = salesLedgerWorkMapper.selectList(salesLedgerWorkLambdaQueryWrapper); |
| | | list.getRecords().forEach(i -> { |
| | | // è·åæäº§æ°é |
| | | i.setSchedulingNum(salesLedgerSchedulings |
| | | .stream() |
| | | .filter(j -> j.getSalesLedgerProductId().equals(i.getId())) |
| | | .map(SalesLedgerScheduling::getSchedulingNum) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | // è·å宿æ°é |
| | | i.setSuccessNum(salesLedgerWorks |
| | | .stream() |
| | | .filter(j -> j.getSalesLedgerProductId().equals(i.getId())) |
| | | .map(SalesLedgerWork::getFinishedNum) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | // ç¶æ = æ°éåå®å·¥æ°éæ¯è¾ |
| | | if(i.getSchedulingNum().compareTo(i.getSuccessNum()) == 0){ |
| | | i.setStatus("已宿"); |
| | | }else{ |
| | | i.setStatus("æªå®æ"); |
| | | } |
| | | }); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | @Override |
| | | public void export(HttpServletResponse response) { |
| | | List<ProductionOrder> list = this.list(); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | throw new RuntimeException("æ å¯¼åºæ°æ®"); |
| | | } |
| | | Set<Long> collect = list.stream().map(ProductionOrder::getId).collect(Collectors.toSet()); |
| | | LambdaQueryWrapper<SalesLedgerWork> salesLedgerWorkLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerWorkLambdaQueryWrapper.in(SalesLedgerWork::getSalesLedgerProductId, collect) |
| | | .ne(SalesLedgerWork::getStatus, 1); |
| | | List<SalesLedgerWork> salesLedgerWorks = salesLedgerWorkMapper.selectList(salesLedgerWorkLambdaQueryWrapper); |
| | | list.forEach(i -> { |
| | | // è·å宿æ°é |
| | | i.setSuccessNum(salesLedgerWorks |
| | | .stream() |
| | | .filter(j -> j.getSalesLedgerProductId().equals(i.getId())) |
| | | .map(SalesLedgerWork::getFinishedNum) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | // ç¶æ = æ°éåå®å·¥æ°éæ¯è¾ |
| | | if(i.getQuantity().compareTo(i.getSuccessNum()) == 0){ |
| | | i.setStatus("已宿"); |
| | | }else{ |
| | | i.setStatus("æªå®æ"); |
| | | } |
| | | }); |
| | | ExcelUtil<ProductionOrder> util = new ExcelUtil<>(ProductionOrder.class); |
| | | util.exportExcel(response, list, "ç产订å"); |
| | | } |
| | | |
| | | @Override |
| | | public void exportOne(HttpServletResponse response) { |
| | | List<ProductionOrder> list = this.list(); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | throw new RuntimeException("æ å¯¼åºæ°æ®"); |
| | | } |
| | | List<DaiDto> dais = new ArrayList<>(); |
| | | list.forEach(i -> { |
| | | DaiDto daiDto = new DaiDto(); |
| | | BeanUtils.copyProperties(i, daiDto); |
| | | // è·åå¾
æäº§æ°é |
| | | daiDto.setDaiNum(daiDto.getQuantity().subtract(i.getSuccessNum())); |
| | | dais.add(daiDto); |
| | | }); |
| | | ExcelUtil<DaiDto> util = new ExcelUtil<>(DaiDto.class); |
| | | util.exportExcel(response, dais, "ç产派工"); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> reportAnalysis(String startDate, String endDate) { |
| | | /* |
| | | * production_order æ°å¢è®¢å表 |
| | | * sales_ledger_scheduling ç产派工表 |
| | | * sales_ledger_work å·¥åºæäº§ |
| | | * sales_ledger_production_accounting ç产æ¥å·¥ |
| | | * */ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //æ±æ»ä¿¡æ¯ |
| | | Map<String, Object> totalMap = new HashMap<>(); |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | if(ObjectUtils.anyNotNull(startDate,endDate)){ |
| | | startTime = LocalDateTime.of(LocalDate.parse(startDate), LocalTime.MIN); |
| | | endTime = LocalDateTime.of(LocalDate.parse(endDate), LocalTime.MAX); |
| | | } |
| | | LambdaQueryWrapper<ProductionOrder> betweenWrapper = Wrappers.<ProductionOrder>lambdaQuery().between(ObjectUtils.anyNotNull(startTime, endTime), ProductionOrder::getCreateTime, startTime, endTime); |
| | | totalMap.put("totalOrderNum",productionOrderMapper.selectCount(betweenWrapper)); |
| | | totalMap.put("tobeProduced", salesLedgerSchedulingMapper.selectTobeProduced(startTime,endTime)); |
| | | totalMap.put("finishProduced",productionOrderMapper.selectFinishProduced(startTime,endTime)); |
| | | totalMap.put("totalWorkhours",productionOrderMapper.selectTotalWorkhours(startTime,endTime)); |
| | | map.put("totalData",totalMap); |
| | | //ç产æ¥å·¥ç»è®¡ |
| | | map.put("productData",productionOrderMapper.selectProductData(startTime,endTime)); |
| | | //çäº§æ ¸ç®ç»è®¡ |
| | | map.put("workHours",productionOrderMapper.selectWorkhoursReport(startTime,endTime)); |
| | | //ç产æ¥å·¥è¯¦ç» |
| | | SalesLedgerWorkDto salesLedgerWorkDto = new SalesLedgerWorkDto(); |
| | | salesLedgerWorkDto.setEntryDateStart(startDate); |
| | | salesLedgerWorkDto.setEntryDateEnd(endDate); |
| | | map.put("productDetails",salesLedgerWorkMapper.listPage(new Page<>(-1,-1), salesLedgerWorkDto).getRecords()); |
| | | return map; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.production.dto.*; |
| | | import com.ruoyi.production.dto.ProcessSchedulingDto; |
| | | import com.ruoyi.production.dto.ProductionDispatchAddDto; |
| | | import com.ruoyi.production.dto.SalesLedgerSchedulingDto; |
| | | import com.ruoyi.production.dto.SalesLedgerSchedulingProcessDto; |
| | | import com.ruoyi.production.mapper.SalesLedgerSchedulingMapper; |
| | | import com.ruoyi.production.mapper.SalesLedgerWorkMapper; |
| | | import com.ruoyi.production.pojo.SalesLedgerScheduling; |
| | |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | |
| | | SysUser sysUser = sysUserMapper.selectUserById(processSchedulingDto.getSchedulingUserId()); |
| | | if(sysUser == null) throw new RuntimeException("æäº§äººä¸åå¨"); |
| | | salesLedgerScheduling.setFinishedNum(salesLedgerScheduling.getFinishedNum().add(processSchedulingDto.getSchedulingNum())); |
| | | LambdaQueryWrapper<SalesLedgerWork> salesLedgerWorkLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | salesLedgerWorkLambdaQueryWrapper.eq(SalesLedgerWork::getSalesLedgerSchedulingId, salesLedgerScheduling.getId()) |
| | | .ne(SalesLedgerWork::getStatus, 1); |
| | | List<SalesLedgerWork> salesLedgerWorks = salesLedgerWorkMapper.selectList(salesLedgerWorkLambdaQueryWrapper); |
| | | if(salesLedgerScheduling.getSchedulingNum().compareTo(salesLedgerScheduling.getFinishedNum()) < 0){ |
| | | throw new RuntimeException("å½åæäº§æ°é大äºå¾
æäº§æ°éï¼è¯·ä»ç»æ ¸å¯¹ï¼"); |
| | | } |
| | |
| | | .salesLedgerProductId(salesLedgerScheduling.getSalesLedgerProductId()) |
| | | .schedulingUserId(salesLedgerScheduling.getSchedulingUserId()) |
| | | .schedulingUserName(sysUser.getNickName()) |
| | | .type(processSchedulingDto.getType()) |
| | | .remark(processSchedulingDto.getRemark()) |
| | | .loss(processSchedulingDto.getLoss()) |
| | | .receive(processSchedulingDto.getReceive()) |
| | | .schedulingNum(processSchedulingDto.getSchedulingNum()) |
| | | .workHours(processSchedulingDto.getWorkHours()) |
| | | .process(processSchedulingDto.getProcess()) |
| | |
| | | return 0; |
| | | } |
| | | |
| | | @Override |
| | | public void exportOne(HttpServletResponse response) { |
| | | List<SalesLedgerSchedulingDto> list = salesLedgerSchedulingMapper.list(); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | throw new RuntimeException("æ å¯¼åºæ°æ®"); |
| | | } |
| | | List<DaiDto> dais = new ArrayList<>(); |
| | | list.forEach(i -> { |
| | | DaiDto daiDto = new DaiDto(); |
| | | BeanUtils.copyProperties(i, daiDto); |
| | | // è·åå¾
æäº§æ°é |
| | | daiDto.setDaiNum(daiDto.getQuantity().subtract(i.getSchedulingNum())); |
| | | dais.add(daiDto); |
| | | }); |
| | | ExcelUtil<DaiDto> util = new ExcelUtil<>(DaiDto.class); |
| | | util.exportExcel(response, dais, "ç产派工"); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductionReportDto; |
| | | import com.ruoyi.production.dto.SalesLedgerWorkDto; |
| | | import com.ruoyi.production.mapper.SalesLedgerProductionAccountingMapper; |
| | | import com.ruoyi.production.mapper.SalesLedgerWorkMapper; |
| | | import com.ruoyi.production.pojo.SalesLedgerProductionAccounting; |
| | | import com.ruoyi.production.pojo.SalesLedgerWork; |
| | | import com.ruoyi.production.service.SalesLedgerProductionAccountingService; |
| | | import com.ruoyi.production.service.SalesLedgerWorkService; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | |
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDept dept)
|
| | | {
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("æ°å¢é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨");
|
| | | }
|
| | | // if (!deptService.checkDeptNameUnique(dept))
|
| | | // {
|
| | | // return error("æ°å¢é¨é¨'" + dept.getDeptName() + "'失败ï¼é¨é¨åç§°å·²åå¨");
|
| | | // }
|
| | | dept.setCreateBy(getUsername());
|
| | | dept.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
| | | return toAjax(deptService.insertDept(dept));
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysPost post)
|
| | | {
|
| | | if (!postService.checkPostNameUnique(post))
|
| | | {
|
| | | return error("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨");
|
| | | }
|
| | | else if (!postService.checkPostCodeUnique(post))
|
| | | {
|
| | | return error("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨");
|
| | | }
|
| | | // if (!postService.checkPostNameUnique(post))
|
| | | // {
|
| | | // return error("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨");
|
| | | // }
|
| | | // else if (!postService.checkPostCodeUnique(post))
|
| | | // {
|
| | | // return error("æ°å¢å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨");
|
| | | // }
|
| | | post.setCreateBy(getUsername());
|
| | | post.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
| | | return toAjax(postService.insertPost(post));
|
| | | }
|
| | |
|
| | |
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysPost post)
|
| | | {
|
| | | if (!postService.checkPostNameUnique(post))
|
| | | {
|
| | | return error("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨");
|
| | | }
|
| | | else if (!postService.checkPostCodeUnique(post))
|
| | | {
|
| | | return error("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨");
|
| | | }
|
| | | // if (!postService.checkPostNameUnique(post))
|
| | | // {
|
| | | // return error("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½åç§°å·²åå¨");
|
| | | // }
|
| | | // else if (!postService.checkPostCodeUnique(post))
|
| | | // {
|
| | | // return error("ä¿®æ¹å²ä½'" + post.getPostName() + "'失败ï¼å²ä½ç¼ç å·²åå¨");
|
| | | // }
|
| | | post.setUpdateBy(getUsername());
|
| | | return toAjax(postService.updatePost(post));
|
| | | }
|
| | |
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysRole role)
|
| | | {
|
| | | if (!roleService.checkRoleNameUnique(role))
|
| | | {
|
| | | return error("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨");
|
| | | }
|
| | | else if (!roleService.checkRoleKeyUnique(role))
|
| | | {
|
| | | return error("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨");
|
| | | }
|
| | | // if (!roleService.checkRoleNameUnique(role))
|
| | | // {
|
| | | // return error("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨");
|
| | | // }
|
| | | // else if (!roleService.checkRoleKeyUnique(role))
|
| | | // {
|
| | | // return error("æ°å¢è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨");
|
| | | // }
|
| | | role.setCreateBy(getUsername());
|
| | | role.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
| | | return toAjax(roleService.insertRole(role));
|
| | |
|
| | | }
|
| | |
| | | public AjaxResult edit(@Validated @RequestBody SysRole role)
|
| | | {
|
| | | roleService.checkRoleAllowed(role);
|
| | | roleService.checkRoleDataScope(role.getRoleId());
|
| | | if (!roleService.checkRoleNameUnique(role))
|
| | | {
|
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨");
|
| | | }
|
| | | else if (!roleService.checkRoleKeyUnique(role))
|
| | | {
|
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨");
|
| | | }
|
| | | // roleService.checkRoleDataScope(role.getRoleId());
|
| | | // if (!roleService.checkRoleNameUnique(role))
|
| | | // {
|
| | | // return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²åç§°å·²åå¨");
|
| | | // }
|
| | | // else if (!roleService.checkRoleKeyUnique(role))
|
| | | // {
|
| | | // return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨");
|
| | | // }
|
| | | role.setUpdateBy(getUsername());
|
| | |
|
| | | if (roleService.updateRole(role) > 0)
|
| | |
| | | }
|
| | | List<SysRole> roles = roleService.selectRoleAll();
|
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
| | | ajax.put("posts", postService.selectPostAll());
|
| | | // ajax.put("posts", postService.selectPostAll());
|
| | | ajax.put("posts", postService.selectPostByTenantId(SecurityUtils.getLoginUser().getTenantId()));
|
| | | SysUserDeptVo sysUserDeptVo = new SysUserDeptVo();
|
| | | sysUserDeptVo.setUserId(userId);
|
| | | List<SysUserDeptVo> sysUserDeptVos = userDeptService.userLoginFacotryList(sysUserDeptVo);
|
| | |
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysUser user)
|
| | | {
|
| | | roleService.checkRoleDataScope(user.getRoleIds());
|
| | | if (!userService.checkUserNameUnique(user))
|
| | | {
|
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
| | | {
|
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
| | | {
|
| | | return error("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨");
|
| | | }
|
| | | // roleService.checkRoleDataScope(user.getRoleIds());
|
| | | // if (!userService.checkUserNameUnique(user))
|
| | | // {
|
| | | // return error("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨");
|
| | | // }
|
| | | // else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
| | | // {
|
| | | // return error("æ°å¢ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨");
|
| | | // }
|
| | | // else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
| | | // {
|
| | | // return error("æ°å¢ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨");
|
| | | // }
|
| | | user.setCreateBy(getUsername());
|
| | | user.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
| | | return toAjax(userService.insertUser(user));
|
| | | }
|
| | |
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysUser user)
|
| | | {
|
| | | userService.checkUserAllowed(user);
|
| | | userService.checkUserDataScope(user.getUserId());
|
| | | roleService.checkRoleDataScope(user.getRoleIds());
|
| | | if (!userService.checkUserNameUnique(user))
|
| | | {
|
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
| | | {
|
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
| | | {
|
| | | return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨");
|
| | | }
|
| | | // userService.checkUserAllowed(user);
|
| | | // userService.checkUserDataScope(user.getUserId());
|
| | | // roleService.checkRoleDataScope(user.getRoleIds());
|
| | | // if (!userService.checkUserNameUnique(user))
|
| | | // {
|
| | | // return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼ç»å½è´¦å·å·²åå¨");
|
| | | // }
|
| | | // else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
| | | // {
|
| | | // return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'å¤±è´¥ï¼ææºå·ç å·²åå¨");
|
| | | // }
|
| | | // else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
| | | // {
|
| | | // return error("ä¿®æ¹ç¨æ·'" + user.getUserName() + "'失败ï¼é®ç®±è´¦å·å·²åå¨");
|
| | | // }
|
| | | user.setUpdateBy(getUsername());
|
| | | userService.bindUserDept(user);
|
| | | return toAjax(userService.updateUser(user));
|
| | |
| | | /** é¨é¨ç¼å· */
|
| | | private String deptNick;
|
| | |
|
| | | /**
|
| | | * ç§æ·id
|
| | | */
|
| | | private Long tenantId;
|
| | |
|
| | | public Long getTenantId() {
|
| | | return tenantId;
|
| | | }
|
| | |
|
| | | public void setTenantId(Long tenantId) {
|
| | | this.tenantId = tenantId;
|
| | | }
|
| | |
|
| | | /** åé¨é¨ */
|
| | | private List<SysDept> children = new ArrayList<SysDept>();
|
| | |
|
| | |
| | | @Excel(name = "ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨")
|
| | | private String status;
|
| | |
|
| | | /**
|
| | | * ç§æ·id
|
| | | */
|
| | | private Long tenantId;
|
| | |
|
| | | public Long getTenantId() {
|
| | | return tenantId;
|
| | | }
|
| | |
|
| | | public void setTenantId(Long tenantId) {
|
| | | this.tenantId = tenantId;
|
| | | }
|
| | |
|
| | | /** ç¨æ·æ¯å¦å卿¤å²ä½æ è¯ é»è®¤ä¸åå¨ */
|
| | | private boolean flag = false;
|
| | |
|
| | |
| | | return roleId != null && 1L == roleId;
|
| | | }
|
| | |
|
| | | /**
|
| | | * ç§æ·id
|
| | | */
|
| | | private Long tenantId;
|
| | |
|
| | | public Long getTenantId() {
|
| | | return tenantId;
|
| | | }
|
| | |
|
| | | public void setTenantId(Long tenantId) {
|
| | | this.tenantId = tenantId;
|
| | | }
|
| | |
|
| | | @NotBlank(message = "è§è²åç§°ä¸è½ä¸ºç©º")
|
| | | @Size(min = 0, max = 30, message = "è§è²åç§°é¿åº¦ä¸è½è¶
è¿30个å符")
|
| | | public String getRoleName()
|
| | |
| | | package com.ruoyi.project.system.mapper;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | |
|
| | |
| | | * @param dept é¨é¨ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int insertDept(SysDept dept);
|
| | |
|
| | | /**
|
| | |
| | | * @param dept é¨é¨ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int updateDept(SysDept dept);
|
| | |
|
| | | /**
|
| | |
| | | *
|
| | | * @param deptIds é¨é¨IDç»
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public void updateDeptStatusNormal(Long[] deptIds);
|
| | |
|
| | | /**
|
| | |
| | | * @param depts åå
ç´
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int updateDeptChildren(@Param("depts") List<SysDept> depts);
|
| | |
|
| | | /**
|
| | |
| | | * @param deptId é¨é¨ID
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int deleteDeptById(Long deptId);
|
| | |
|
| | | /**
|
| | |
| | | * @return
|
| | | */
|
| | | Long maxLevelDeptId(Long deptId);
|
| | |
|
| | | SysDept selectDeptByDeptName(@Param("deptName") String deptName);
|
| | | }
|
| | |
| | | package com.ruoyi.project.system.mapper;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
| | | import com.ruoyi.project.system.domain.SysPost;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | /**
|
| | | * å²ä½ä¿¡æ¯ æ°æ®å±
|
| | |
| | | * @param postId å²ä½ID
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int deletePostById(Long postId);
|
| | |
|
| | | /**
|
| | |
| | | * @param postIds éè¦å é¤çå²ä½ID
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int deletePostByIds(Long[] postIds);
|
| | |
|
| | | /**
|
| | |
| | | * @param post å²ä½ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int updatePost(SysPost post);
|
| | |
|
| | | /**
|
| | |
| | | * @param post å²ä½ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int insertPost(SysPost post);
|
| | |
|
| | | /**
|
| | |
| | | * @return ç»æ
|
| | | */
|
| | | public SysPost checkPostCodeUnique(String postCode);
|
| | |
|
| | | List<SysPost> selectPostByTenantId(@Param("tenantId") Long tenantId);
|
| | | }
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | |
| | | * @param user ç¨æ·ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int insertUser(SysUser user);
|
| | |
|
| | | /**
|
| | |
| | | * @param user ç¨æ·ä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int updateUser(SysUser user);
|
| | |
|
| | | /**
|
| | |
| | | * @param avatar 头åå°å
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
|
| | |
|
| | | /**
|
| | |
| | | * @param password å¯ç
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
|
| | |
|
| | | /**
|
| | |
| | | * @param userId ç¨æ·ID
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int deleteUserById(Long userId);
|
| | |
|
| | | /**
|
| | |
| | | * @param userIds éè¦å é¤çç¨æ·ID
|
| | | * @return ç»æ
|
| | | */
|
| | | @InterceptorIgnore(tenantLine = "true")
|
| | | public int deleteUserByIds(Long[] userIds);
|
| | |
|
| | | /**
|
| | |
| | | import com.ruoyi.framework.web.domain.TreeSelect;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | |
|
| | | import javax.validation.constraints.NotBlank;
|
| | | import javax.validation.constraints.Size;
|
| | |
|
| | | /**
|
| | | * é¨é¨ç®¡ç æå¡å±
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | Long maxLevelDeptId(Long deptId);
|
| | | /**
|
| | | * æ ¹æ®é¨é¨åç§°æ¥è¯¢é¨é¨ä¿¡æ¯
|
| | | *
|
| | | * @param deptName é¨é¨åç§°
|
| | | * @return é¨é¨ä¿¡æ¯éå
|
| | | */
|
| | | public SysDept selectDeptByDeptName(String deptName);
|
| | | }
|
| | |
| | | * @return ç»æ
|
| | | */
|
| | | public int updatePost(SysPost post);
|
| | |
|
| | | public List<SysPost> selectPostByTenantId(Long tenantId);
|
| | | }
|
| | |
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | import cn.hutool.core.util.ObjectUtil;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | |
| | | * @return é¨é¨ä¿¡æ¯éå
|
| | | */
|
| | | @Override
|
| | | @DataScope(deptAlias = "d")
|
| | | @DataScope(tenantIdFelid = "d")
|
| | | public List<SysDept> selectDeptList(SysDept dept)
|
| | | {
|
| | | return deptMapper.selectDeptList(dept);
|
| | |
| | | {
|
| | | SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
| | | // 妿ç¶èç¹ä¸ä¸ºæ£å¸¸ç¶æ,åä¸å
许æ°å¢åèç¹
|
| | | if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
| | | if (ObjectUtil.isNotNull(info) && !UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
| | | {
|
| | | throw new ServiceException("é¨é¨åç¨ï¼ä¸å
许æ°å¢");
|
| | | }
|
| | | if(ObjectUtil.isNotNull(info) && 0L!=dept.getParentId()){
|
| | | dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
| | | }else{
|
| | | dept.setAncestors("0");
|
| | | }
|
| | | return deptMapper.insertDept(dept);
|
| | | }
|
| | |
|
| | |
| | | deptMapper.updateDeptStatusNormal(deptIds);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public SysDept selectDeptByDeptName(String deptName) {
|
| | | return deptMapper.selectDeptByDeptName(deptName);
|
| | | }
|
| | |
|
| | | /**
|
| | | * ä¿®æ¹åå
ç´ å
³ç³»
|
| | | *
|
| | |
| | | package com.ruoyi.project.system.service.impl;
|
| | |
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | |
| | | * @return å²ä½ä¿¡æ¯éå
|
| | | */
|
| | | @Override
|
| | | @DataScope(tenantIdFelid = "p")
|
| | | public List<SysPost> selectPostList(SysPost post)
|
| | | {
|
| | | return postMapper.selectPostList(post);
|
| | |
| | | {
|
| | | return postMapper.updatePost(post);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @DataScope(tenantIdFelid = "p")
|
| | | public List<SysPost> selectPostByTenantId(Long tenantId) {
|
| | | return postMapper.selectPostByTenantId(tenantId);
|
| | | }
|
| | | }
|
| | |
| | | * @return è§è²æ°æ®éåä¿¡æ¯
|
| | | */
|
| | | @Override
|
| | | @DataScope(deptAlias = "d")
|
| | | @DataScope(tenantIdFelid = "r")
|
| | | public List<SysRole> selectRoleList(SysRole role)
|
| | | {
|
| | | return roleMapper.selectRoleList(role);
|
| | |
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯
|
| | | */
|
| | | @Override
|
| | | @DataScope(deptAlias = "d", userAlias = "u")
|
| | | @DataScope(tenantIdFelid = "u")
|
| | | public List<SysUser> selectUserList(SysUser user)
|
| | | {
|
| | | return userMapper.selectUserList(user);
|
| | |
| | | * @return
|
| | | */
|
| | | @Override
|
| | | // @DataScope(tenantIdFelid = "u")
|
| | | public List<SysUser> userListNoPage(SysUser user) {
|
| | | return userMapper.selectUserList(user);
|
| | | }
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.tide.controller; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.security.service.SysLoginService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.service.ISysDeptService; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | import com.ruoyi.tide.pojo.TidePojo; |
| | | import com.ruoyi.tide.utils.TideUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | import javax.annotation.security.PermitAll; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | @RequestMapping("/tide") |
| | | @RestController |
| | | @Api(tags = "å¯¹æ¥æµªæ½®ç³»ç»") |
| | | @Anonymous |
| | | @Slf4j |
| | | public class TideController { |
| | | |
| | | @Autowired |
| | | private SysLoginService loginService; |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | @ApiOperation(value = "ç»å½") |
| | | @PostMapping("/tideLogin") |
| | | public AjaxResult login(@RequestBody TidePojo tidePojo) { |
| | | String token = TideUtils.getToken(tidePojo.getCode()); |
| | | JSONObject userInfo = TideUtils.getUserInfo(token); |
| | | JSONObject tenant = JSONObject.parseObject(userInfo.get("tenant").toString()); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // çæä»¤ç |
| | | String generateToken = loginService.login(tenant.get("tenantAccount").toString(), tenant.get("tenantPassword").toString(), null, |
| | | IdWorker.get32UUID()); |
| | | ajax.put(Constants.TOKEN, generateToken); |
| | | return ajax; |
| | | } |
| | | |
| | | @PostMapping("/applicationOrdering") |
| | | @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) |
| | | public JSONObject order (@RequestBody TidePojo tidePojo) { |
| | | SysUser user = userService.selectUserByUserName(tidePojo.getPltAccountLogin()); |
| | | String defaultPwd = "I73Kj+Mn$+SI";//é»è®¤å¼éå¯ç åºå®åæ» |
| | | // String randomString = TideUtils.getRandomString(12); |
| | | //è´¦å·ä¸åå¨ï¼æ§è¡æ°å¢æä½ |
| | | if(ObjectUtils.isEmpty(user)){ |
| | | //1.å
æ°å¢ç¨æ·å¯¹åºçå
¬å¸ |
| | | SysDept dept = new SysDept(); |
| | | dept.setParentId(0L);//ç¶å
¬å¸id |
| | | dept.setDeptName(tidePojo.getEnterpriseName()); |
| | | dept.setDeptNick(tidePojo.getEnterpriseName()); |
| | | dept.setOrderNum(0); |
| | | boolean deptNameUnique = deptService.checkDeptNameUnique(dept); |
| | | if (deptNameUnique){ |
| | | deptService.insertDept(dept); |
| | | } |
| | | //æ¥è¯¢å
¬å¸ |
| | | SysDept newSysDept = deptService.selectDeptByDeptName(dept.getDeptName()); |
| | | dept.setDeptId(ObjectUtils.isEmpty(newSysDept)?100L:newSysDept.getDeptId()); |
| | | dept.setTenantId(dept.getDeptId()); |
| | | deptService.updateDept(dept); |
| | | user = new SysUser(); |
| | | String password = SecurityUtils.encryptPassword(defaultPwd); |
| | | user.setPassword(password); |
| | | user.setUserName(tidePojo.getPltAccountLogin()); |
| | | user.setNickName(tidePojo.getEnterpriseName()); |
| | | user.setStatus("0"); |
| | | user.setDelFlag("0"); |
| | | user.setPostIds(new Long[]{1L}); |
| | | user.setRoleId(1L); |
| | | user.setRoleIds(new Long[]{2L});//é»è®¤æ®éè§è² |
| | | user.setDeptIds(new Long[]{dept.getDeptId()});//ç»å®å
¬å¸ |
| | | user.setTenantId(dept.getDeptId()); |
| | | userService.insertUser(user); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("account", tidePojo.getPltAccountLogin()); |
| | | map.put("token", defaultPwd); |
| | | map.put("tenantId", user.getUserId()); |
| | | return TideUtils.getResult(20000, "æå", map); |
| | | } |
| | | |
| | | @PostMapping("/cancellation") |
| | | public JSONObject cancellation (@RequestBody TidePojo tidePojo) { |
| | | log.info("æ§è¡äºæ³¨éä¿¡æ¯ï¼" + tidePojo); |
| | | if(Objects.nonNull(tidePojo)){ |
| | | SysUser sysUser = userService.selectUserByUserName(tidePojo.getPltAccountLogin()); |
| | | if(Objects.nonNull(sysUser)){ |
| | | userService.deleteUserById(sysUser.getUserId()); |
| | | } |
| | | } |
| | | return TideUtils.getResult(20000, "æå", null); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String password = SecurityUtils.encryptPassword("c($Rb_@!n%U7"); |
| | | System.out.println(password); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.tide.pojo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TidePojo { |
| | | @ApiModelProperty("ä¼ä¸åç§°") |
| | | private String enterpriseName; |
| | | |
| | | @ApiModelProperty("å¹³å°ç¨æ·") |
| | | private String pltUserCn; |
| | | |
| | | @ApiModelProperty("å¹³å°è´¦å·") |
| | | private String pltAccountLogin; |
| | | |
| | | @ApiModelProperty("è®¢è´æ¶é¿") |
| | | private Integer purchaseDuration; |
| | | |
| | | @ApiModelProperty("è®¢åæ¶é¿åä½") |
| | | private String purchaseUnit; |
| | | |
| | | @ApiModelProperty("appKey") |
| | | private String appKey; |
| | | |
| | | @ApiModelProperty("appSecret") |
| | | private String appSecret; |
| | | |
| | | @ApiModelProperty("code") |
| | | private String code; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.tide.utils; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.crypto.digest.HMac; |
| | | import cn.hutool.crypto.digest.HmacAlgorithm; |
| | | import cn.hutool.http.HttpRequest; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.SecureRandom; |
| | | import java.util.HashMap; |
| | | |
| | | @Data |
| | | @Component |
| | | @Slf4j |
| | | public class TideUtils { |
| | | |
| | | public static String APP_ID; |
| | | public static String APP_SECRET; |
| | | |
| | | |
| | | @Value("${inspur.appId}") |
| | | private String appId; |
| | | |
| | | @Value("${inspur.appSecret}") |
| | | private String appSecret; |
| | | |
| | | @Value("${inspur.appId}") |
| | | public void setAppId(String appId) { |
| | | TideUtils.APP_ID = appId; |
| | | } |
| | | |
| | | @Value("${inspur.appSecret}") |
| | | public void setAppSecret(String appSecret) { |
| | | TideUtils.APP_SECRET = appSecret; |
| | | } |
| | | |
| | | // å
ç½å°å |
| | | private final static String ip = "http://10.136.0.8:8083"; |
| | | |
| | | // MD5å å¯å¹¶è½¬æ¢ä¸º16è¿å¶ |
| | | public static String md5Encryption(String input) { |
| | | try { |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | byte[] digest = md.digest(input.getBytes()); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (byte b : digest) { |
| | | sb.append(String.format("%02x", b & 0xff)); |
| | | } |
| | | return sb.toString(); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | // getè¯·æ± |
| | | public static HashMap<String, String> getGetHeader(String parameter) { |
| | | // æ¶é´æ³ |
| | | String xTime = String.valueOf(DateUtil.current()); |
| | | // è·åéæº16ä½å符串 |
| | | String xRandom = RandomUtil.randomString(16); |
| | | String xSignSplicingTogether; |
| | | // æåæ° |
| | | if (ObjectUtils.isNotEmpty(parameter)) { |
| | | // å å¯å¾åºx-body |
| | | String xBody = md5Encryption(parameter); |
| | | // 为x-signå å¯åæ¼æ¥ |
| | | xSignSplicingTogether = "x-body=" + xBody + "&x-random=" + xRandom + "&x-time=" + xTime; |
| | | // æ åæ° |
| | | } else { |
| | | xSignSplicingTogether = "x-random=" + xRandom + "&x-time=" + xTime; |
| | | } |
| | | // é
ç½®å 坿¹å¼ä¸å¯é¥ |
| | | HMac hMac = new HMac(HmacAlgorithm.HmacSHA256, APP_SECRET.getBytes()); |
| | | // å¾åºx-sign |
| | | String xSign = hMac.digestHex(xSignSplicingTogether); |
| | | HashMap<String, String> result = new HashMap<>(); |
| | | result.put("x-time", xTime); |
| | | result.put("x-random", xRandom); |
| | | result.put("x-sign", xSign); |
| | | result.put("appKey", APP_ID); |
| | | return result; |
| | | } |
| | | |
| | | // postè¯·æ± |
| | | public static HashMap<String, String> getPostHeader(String parameter) { |
| | | // æ¶é´æ³ |
| | | String xTime = String.valueOf(DateUtil.current()); |
| | | // è·åéæº16ä½å符串 |
| | | String xRandom = RandomUtil.randomString(16); |
| | | String xSignSplicingTogether; |
| | | // æåæ° |
| | | if (ObjectUtils.isNotEmpty(parameter)) { |
| | | // å å¯å¾åºx-body |
| | | String xBody = md5Encryption(parameter); |
| | | // 为x-signå å¯åæ¼æ¥ |
| | | xSignSplicingTogether = "x-body=" + xBody + "&x-random=" + xRandom + "&x-time=" + xTime; |
| | | // æ åæ° |
| | | } else { |
| | | xSignSplicingTogether = "x-random=" + xRandom + "&x-time=" + xTime; |
| | | } |
| | | // x-sign å å¯ |
| | | HMac hMac = new HMac(HmacAlgorithm.HmacSHA256, APP_SECRET.getBytes()); |
| | | String xSign = hMac.digestHex(xSignSplicingTogether); |
| | | HashMap<String, String> result = new HashMap<>(); |
| | | result.put("x-time", xTime); |
| | | result.put("x-random", xRandom); |
| | | result.put("x-sign", xSign); |
| | | result.put("appKey", APP_ID); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * äºåé䏿¬¡çå¿è·³ |
| | | */ |
| | | @Scheduled(cron = "0 0/5 * * * ?") |
| | | public static void heartbeat(){ |
| | | HashMap<String, String> header = getGetHeader(null); |
| | | String url = ip + "/cpn/api/extra/v1/application/heartbeat"; |
| | | String body = HttpRequest.get(url).headerMap(header, false).execute().body(); |
| | | System.out.println(body + "åºç¨å¿è·³æ§è¡æåï¼"); |
| | | } |
| | | |
| | | // è·åtoken |
| | | public static String getToken(String code) { |
| | | String url = ip + "/cpn/extral/applicationCode/appAuthCheck"; |
| | | JSONObject json = new JSONObject(); |
| | | json.put("code", code); |
| | | json.put("appID", APP_ID); |
| | | json.put("appSecret", APP_SECRET); |
| | | HashMap<String, String> header = getPostHeader(json.toString()); |
| | | String body = HttpRequest.post(url) |
| | | .headerMap(header, false) |
| | | .body(json.toString()) |
| | | .execute().body(); |
| | | JSONObject jsonObject = JSONObject.parseObject(body); |
| | | return jsonObject.get("data").toString(); |
| | | } |
| | | |
| | | // è·åç¨æ·ä¿¡æ¯ |
| | | public static JSONObject getUserInfo(String token) { |
| | | String url = ip + "/cpn/api/extral/applicationCode/getUserInfoByToken"; |
| | | JSONObject json = new JSONObject(); |
| | | json.put("appID", APP_ID); |
| | | HashMap<String, String> header = getPostHeader(json.toString()); |
| | | header.put("Authorization", token); |
| | | String body = HttpRequest.post(url) |
| | | .headerMap(header, false) |
| | | .body(json.toString()) |
| | | .execute().body(); |
| | | JSONObject jsonObject = JSONObject.parseObject(body); |
| | | return JSONObject.parseObject(jsonObject.get("data").toString()); |
| | | } |
| | | |
| | | public static JSONObject getResult(Integer code, String msg, Object data) { |
| | | JSONObject json = new JSONObject(); |
| | | json.put("code", code); |
| | | json.put("msg", msg); |
| | | json.put("data", data); |
| | | String xRandom = RandomUtil.randomString(16); |
| | | json.put("traceId", xRandom); |
| | | return json; |
| | | } |
| | | |
| | | public static String getRandomString(int length) { |
| | | SecureRandom random = new SecureRandom(); |
| | | String uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| | | String lowercaseLetters = "abcdefghijklmnopqrstuvwxyz"; |
| | | String numbers = "0123456789"; |
| | | String specialCharacters = "!@$%^&*()_+-=."; |
| | | String characterSet = uppercaseLetters + lowercaseLetters + numbers + specialCharacters; |
| | | StringBuilder passwordBuilder = new StringBuilder(); |
| | | |
| | | for (int i = 0; i < length; i++) { |
| | | int randomIndex = random.nextInt(characterSet.length()); |
| | | char randomChar = characterSet.charAt(randomIndex); |
| | | passwordBuilder.append(randomChar); |
| | | } |
| | | |
| | | return passwordBuilder.toString(); |
| | | } |
| | | } |
| ÎļþÃû´Ó src/main/resources/application-nydl.yml ÐÞ¸Ä |
| | |
| | | # è¯å¯¼-MESå¶é æ§è¡ç³»ç»é¡¹ç®ç¸å
³é
ç½® |
| | | inspur: |
| | | appId: 19472937-3039-4bf1-8334-13dc20e076e5 |
| | | appSecret: b57bbad60724f810e7bb7e1e7b8791b63eba50e50faef6fa819ade822fac9e4a |
| | | # 项ç®ç¸å
³é
ç½® |
| | | ruoyi: |
| | | # åç§° |
| | |
| | | # å¼åç¯å¢é
ç½® |
| | | server: |
| | | # æå¡å¨çHTTP端å£ï¼é»è®¤ä¸º8080 |
| | | port: 9104 |
| | | port: 8009 |
| | | servlet: |
| | | # åºç¨ç访é®è·¯å¾ |
| | | context-path: / |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:mysql://192.168.0.182:3306/product-inventory-management-nydl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://10.136.12.71:3306/mes-ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: HpencZdyK7WrtQvBUKnr |
| | | password: zttZTT123! |
| | | # ä»åºæ°æ®æº |
| | | slave: |
| | | # 仿°æ®æºå¼å
³/é»è®¤å
³é |
| | |
| | | redis: |
| | | # å°å |
| | | # host: 127.0.0.1 |
| | | host: 192.168.0.182 |
| | | host: 10.136.12.71 |
| | | # 端å£ï¼é»è®¤ä¸º6379 |
| | | port: 6379 |
| | | # æ°æ®åºç´¢å¼ |
| | | database: 0 |
| | | database: 14 |
| | | # å¯ç |
| | | # password: root2022! |
| | | password: |
| | | password: zttZTT123! |
| | | |
| | | # è¿æ¥è¶
æ¶æ¶é´ |
| | | timeout: 10s |
| | |
| | | # Springé
ç½® |
| | | spring: |
| | | profiles: |
| | | active: demo |
| | | active: tide |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="com.ruoyi.production.mapper.ProductionOrderMapper"> |
| | | |
| | | <select id="selectFinishProduced" resultType="java.lang.Double"> |
| | | SELECT |
| | | IFNULL(SUM( finished_num ),0) finished_num |
| | | FROM |
| | | sales_ledger_production_accounting |
| | | <where> |
| | | <if test="startTime !=null and endTime!=null"> |
| | | AND create_time BETWEEN #{startTime} AND #{endTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectTotalWorkhours" resultType="java.lang.Double"> |
| | | SELECT |
| | | IFNULL(SUM( work_hours ),0) finished_num |
| | | FROM |
| | | sales_ledger_production_accounting |
| | | <where> |
| | | <if test="startTime !=null and endTime!=null"> |
| | | AND create_time BETWEEN #{startTime} AND #{endTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectProductData" resultType="java.util.Map"> |
| | | select |
| | | SUM(CASE WHEN `status`=1 THEN scheduling_num ELSE 0 END) AS tobeProduced, |
| | | SUM(CASE WHEN `status`=2 THEN (scheduling_num-finished_num) ELSE 0 END) AS inProduced, |
| | | SUM(CASE WHEN `status`=3 THEN finished_num ELSE 0 END) AS finishProduced |
| | | from sales_ledger_work |
| | | <where> |
| | | <if test="startTime !=null and endTime!=null"> |
| | | AND create_time BETWEEN #{startTime} AND #{endTime} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectWorkhoursReport" resultType="java.util.Map"> |
| | | select |
| | | SUM(work_hours) AS workHours, |
| | | process |
| | | from sales_ledger_production_accounting |
| | | <where> |
| | | <if test="startTime !=null and endTime!=null"> |
| | | AND create_time BETWEEN #{startTime} AND #{endTime} |
| | | </if> |
| | | </where> |
| | | GROUP BY process |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | t4.finished_num, |
| | | t4.work_hours, |
| | | t4.process, |
| | | T1.sales_contract_no, |
| | | T1.customer_contract_no, |
| | | T1.project_name, |
| | | T1.customer_name, |
| | | t3.product_category, |
| | | t3.specification_model, |
| | | t3.unit |
| | | FROM |
| | | sales_ledger_production_accounting t4 |
| | | LEFT JOIN sales_ledger T1 ON T1.id = t4.sales_ledger_id |
| | | left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id |
| | | LEFT JOIN production_order t3 on t3.id = t4.sales_ledger_product_id |
| | | <where> |
| | | t3.type = 1 |
| | | <if test="salesLedgerDto.schedulingUserName != null and salesLedgerDto.schedulingUserName != '' "> |
| | | AND t4.scheduling_user_name LIKE CONCAT('%',#{salesLedgerDto.schedulingUserName},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' "> |
| | | AND T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.customerContractNo != null and salesLedgerDto.customerContractNo !='' "> |
| | | AND T1.customer_contract_no LIKE CONCAT('%',#{salesLedgerDto.customerContractNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.salesContractNo != null and salesLedgerDto.salesContractNo != '' "> |
| | | AND T1.sales_contract_no LIKE CONCAT('%',#{salesLedgerDto.salesContractNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.projectName != null and salesLedgerDto.projectName != '' "> |
| | | AND T1.project_name LIKE CONCAT('%',#{salesLedgerDto.projectName},'%') |
| | | <if test="salesLedgerDto.productCategory != null and salesLedgerDto.productCategory != '' "> |
| | | AND t3.product_category LIKE CONCAT('%',#{salesLedgerDto.productCategory},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.entryDateStart != null and salesLedgerDto.entryDateStart != '' "> |
| | | AND t4.scheduling_date >= DATE_FORMAT(#{salesLedgerDto.entryDateStart},'%Y-%m-%d') |
| | |
| | | <select id="listPageProcess" resultType="com.ruoyi.production.dto.SalesLedgerSchedulingProcessDto"> |
| | | SELECT |
| | | t3.id as salesLedgerProductId, |
| | | T1.id as salesLedgerId, |
| | | T2.id, |
| | | T2.status, |
| | | T2.scheduling_user_id, |
| | |
| | | T2.scheduling_date, |
| | | ifNull(T2.scheduling_num,0) AS schedulingNum, |
| | | ifNull(T2.finished_num,0) AS successNum, |
| | | T1.sales_contract_no, |
| | | T1.customer_contract_no, |
| | | T1.project_name, |
| | | T1.customer_name, |
| | | t3.product_category, |
| | | t3.specification_model, |
| | | t3.unit |
| | | t3.unit, |
| | | t3.order_no |
| | | FROM |
| | | sales_ledger_scheduling T2 |
| | | LEFT JOIN sales_ledger T1 ON T1.id = T2.sales_ledger_id |
| | | left join sales_ledger_product t3 on T2.sales_ledger_product_id = t3.id |
| | | LEFT JOIN production_order t3 on t3.id = T2.sales_ledger_product_id |
| | | <where> |
| | | t3.type = 1 |
| | | <if test="salesLedgerDto.status != null and salesLedgerDto.status != '' "> |
| | | AND T2.status = #{salesLedgerDto.status} |
| | | </if> |
| | | <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' "> |
| | | AND T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%') |
| | | <if test="salesLedgerDto.orderNo != null and salesLedgerDto.orderNo != '' "> |
| | | AND T1.order_no LIKE CONCAT('%',#{salesLedgerDto.orderNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.customerContractNo != null and salesLedgerDto.customerContractNo !='' "> |
| | | AND T1.customer_contract_no LIKE CONCAT('%',#{salesLedgerDto.customerContractNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.salesContractNo != null and salesLedgerDto.salesContractNo != '' "> |
| | | AND T1.sales_contract_no LIKE CONCAT('%',#{salesLedgerDto.salesContractNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.projectName != null and salesLedgerDto.projectName != '' "> |
| | | AND T1.project_name LIKE CONCAT('%',#{salesLedgerDto.projectName},'%') |
| | | <if test="salesLedgerDto.productCategory != null and salesLedgerDto.productCategory !='' "> |
| | | AND t3.productCategory LIKE CONCAT('%',#{salesLedgerDto.productCategory},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.entryDateStart != null and salesLedgerDto.entryDateStart != '' "> |
| | | AND T2.scheduling_date >= DATE_FORMAT(#{salesLedgerDto.entryDateStart},'%Y-%m-%d') |
| | |
| | | </where> |
| | | order by T2.status asc |
| | | </select> |
| | | <select id="selectTobeProduced" resultType="java.lang.Double"> |
| | | SELECT |
| | | IFNULL(SUM(scheduling_num - finished_num),0) AS calc_num |
| | | FROM |
| | | sales_ledger_scheduling |
| | | |
| | | WHERE `status` = 1 |
| | | <if test="startTime !=null and endTime!=null"> |
| | | AND create_time BETWEEN #{startTime} AND #{endTime} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | t4.finished_num, |
| | | t4.work_hours, |
| | | t4.process, |
| | | T1.sales_contract_no, |
| | | T1.customer_contract_no, |
| | | T1.project_name, |
| | | T1.customer_name, |
| | | t4.type, |
| | | t4.receive, |
| | | t4.loss, |
| | | t4.remark, |
| | | t3.product_category, |
| | | t3.specification_model, |
| | | t3.unit |
| | | t3.unit, |
| | | t3.order_no |
| | | FROM |
| | | sales_ledger_work t4 |
| | | LEFT JOIN sales_ledger T1 ON T1.id = t4.sales_ledger_id |
| | | left join sales_ledger_product t3 on t4.sales_ledger_product_id = t3.id |
| | | LEFT JOIN production_order t3 on t3.id = t4.sales_ledger_product_id |
| | | <where> |
| | | t3.type = 1 |
| | | <if test="salesLedgerDto.status != null and salesLedgerDto.status != '' "> |
| | | AND t4.status = #{salesLedgerDto.status} |
| | | </if> |
| | | <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' "> |
| | | AND T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%') |
| | | <if test="salesLedgerDto.orderNo != null and salesLedgerDto.orderNo != '' "> |
| | | AND t3.order_no LIKE CONCAT('%',#{salesLedgerDto.orderNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.customerContractNo != null and salesLedgerDto.customerContractNo !='' "> |
| | | AND T1.customer_contract_no LIKE CONCAT('%',#{salesLedgerDto.customerContractNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.salesContractNo != null and salesLedgerDto.salesContractNo != '' "> |
| | | AND T1.sales_contract_no LIKE CONCAT('%',#{salesLedgerDto.salesContractNo},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.projectName != null and salesLedgerDto.projectName != '' "> |
| | | AND T1.project_name LIKE CONCAT('%',#{salesLedgerDto.projectName},'%') |
| | | <if test="salesLedgerDto.productCategory != null and salesLedgerDto.productCategory !='' "> |
| | | AND t3.productCategory LIKE CONCAT('%',#{salesLedgerDto.productCategory},'%') |
| | | </if> |
| | | <if test="salesLedgerDto.entryDateStart != null and salesLedgerDto.entryDateStart != '' "> |
| | | AND t4.scheduling_date >= DATE_FORMAT(#{salesLedgerDto.entryDateStart},'%Y-%m-%d') |
| | |
| | | <if test="email != null and email != ''">email,</if> |
| | | <if test="deptNick != null and deptNick != ''">dept_nick,</if> |
| | | <if test="status != null">status,</if> |
| | | <if test="tenantId != null and tenantId != ''">tenant_id,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | |
| | | <if test="email != null and email != ''">#{email},</if> |
| | | <if test="deptNick != null and deptNick != '' ">#{deptNick},</if> |
| | | <if test="status != null">#{status},</if> |
| | | <if test="tenantId != null and tenantId != '' ">#{tenantId},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | |
| | | <if test="email != null">email = #{email},</if> |
| | | <if test="deptNick != null and deptNick != '' ">dept_nick = #{deptNick},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | |
| | | FROM DepartmentHierarchy |
| | | WHERE parent_id = 100; |
| | | </select> |
| | | <select id="selectDeptByDeptName" resultType="com.ruoyi.project.system.domain.SysDept"> |
| | | <include refid="selectDeptVo"/> |
| | | WHERE d.dept_name = #{deptName} |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <sql id="selectPostVo"> |
| | | select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark |
| | | from sys_post |
| | | from sys_post p |
| | | </sql> |
| | | |
| | | <select id="selectPostList" parameterType="com.ruoyi.project.system.domain.SysPost" resultMap="SysPostResult"> |
| | |
| | | <if test="postName != null and postName != ''"> |
| | | AND post_name like concat('%', #{postName}, '%') |
| | | </if> |
| | | <!-- æ°æ®èå´è¿æ»¤ --> |
| | | ${params.dataScope} |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <include refid="selectPostVo"/> |
| | | where post_code=#{postCode} limit 1 |
| | | </select> |
| | | <select id="selectPostByTenantId" resultType="com.ruoyi.project.system.domain.SysPost"> |
| | | <include refid="selectPostVo"/> |
| | | <where> |
| | | AND p.tenant_id = #{tenantId} |
| | | </where> |
| | | </select> |
| | | |
| | | <update id="updatePost" parameterType="com.ruoyi.project.system.domain.SysPost"> |
| | | update sys_post |
| | |
| | | <if test="postSort != null">post_sort,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="tenantId != null and tenantId != ''">tenant_id,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | |
| | | <if test="postSort != null">#{postSort},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="tenantId != null and tenantId != ''">#{tenantId},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | |
| | | from sys_role r |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | left join sys_user u on u.user_id = ur.user_id |
| | | left join sys_user_dept d on u.user_id = d.user_id |
| | | </sql> |
| | | |
| | | <select id="selectRoleList" parameterType="com.ruoyi.project.system.domain.SysRole" resultMap="SysRoleResult"> |
| | |
| | | <if test="deptCheckStrictly != null">dept_check_strictly,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="tenantId != null and tenantId != ''">tenant_id,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | |
| | | <if test="deptCheckStrictly != null">#{deptCheckStrictly},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="tenantId != null and tenantId != ''">#{tenantId},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | |
| | | |
| | | <select id="selectUserList" parameterType="com.ruoyi.project.system.domain.SysUser" resultMap="SysUserResult"> |
| | | select u.user_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,T2.dept_names from sys_user u |
| | | left join |
| | | inner join |
| | | ( SELECT T1.user_id,GROUP_CONCAT(T2.dept_name SEPARATOR ', ') AS dept_names |
| | | FROM |
| | | sys_user_dept T1 |
| | |
| | | <!-- é
ç½®é»è®¤çæ§è¡å¨.SIMPLEå°±æ¯æ®éæ§è¡å¨;REUSEæ§è¡å¨ä¼éç¨é¢å¤çè¯å¥(prepared statements);BATCHæ§è¡å¨å°éç¨è¯å¥å¹¶æ§è¡æ¹éæ´æ° -->
|
| | | <setting name="defaultExecutorType" value="SIMPLE" />
|
| | | <!-- æå® MyBatis æç¨æ¥å¿çå
·ä½å®ç° -->
|
| | | <setting name="logImpl" value="SLF4J" />
|
| | | <!-- <setting name="logImpl" value="org.apache.ibatis.logging.stdout.StdOutImpl" />-->
|
| | | <!-- <setting name="logImpl" value="SLF4J" />-->
|
| | | <setting name="logImpl" value="org.apache.ibatis.logging.stdout.StdOutImpl" />
|
| | | <!-- 使ç¨é©¼å³°å½åæ³è½¬æ¢å段 -->
|
| | | <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
| | | </settings>
|