parent
c086675451
commit
0ef80c4dcb
8 changed files with 237 additions and 82 deletions
@ -0,0 +1,104 @@ |
|||||||
|
package org.springblade.lims.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springblade.core.mp.support.Condition; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
import org.springblade.core.secure.utils.AuthUtil; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.lims.entry.Instrument; |
||||||
|
import org.springblade.lims.entry.RepairApplication; |
||||||
|
import org.springblade.lims.entry.ScrapApplication; |
||||||
|
import org.springblade.lims.service.IInstrumentService; |
||||||
|
import org.springblade.lims.service.IRepairApplicationService; |
||||||
|
import org.springblade.lims.service.IScrapApplicationService; |
||||||
|
import org.springblade.resource.enums.SysTypeEnum; |
||||||
|
import org.springblade.resource.feign.IMessageClient; |
||||||
|
import org.springblade.system.user.entity.User; |
||||||
|
import org.springblade.system.user.feign.IUserClient; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author swj |
||||||
|
* @since 2022年6月1日19:49:10 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/scrapApplication") |
||||||
|
@Api(value = "", tags = "") |
||||||
|
public class ScrapApplicationController extends BladeController { |
||||||
|
|
||||||
|
private final IScrapApplicationService scrapApplicationService; |
||||||
|
|
||||||
|
private final IMessageClient messageClient; |
||||||
|
|
||||||
|
private final IUserClient userClient; |
||||||
|
|
||||||
|
private final IInstrumentService instrumentService; |
||||||
|
/** |
||||||
|
* 分页 列表 |
||||||
|
*/ |
||||||
|
@GetMapping("/list") |
||||||
|
public R<IPage> list(ScrapApplication scrapApplication, Query query) { |
||||||
|
LambdaQueryWrapper<ScrapApplication> wrapper = new LambdaQueryWrapper<>(); |
||||||
|
if (scrapApplication.getStatus() != null) { |
||||||
|
wrapper.eq(ScrapApplication::getStatus, scrapApplication.getStatus()); |
||||||
|
} |
||||||
|
if (scrapApplication.getName() != null && !"".equals(scrapApplication.getName())) { |
||||||
|
wrapper.and(qw -> qw |
||||||
|
.like(ScrapApplication::getCode, scrapApplication.getName()).or() |
||||||
|
.like(ScrapApplication::getName, scrapApplication.getName()).or() |
||||||
|
.like(ScrapApplication::getType, scrapApplication.getName()) |
||||||
|
); |
||||||
|
} |
||||||
|
if (scrapApplication.getStartTime() != null && scrapApplication.getEndTime() != null) { |
||||||
|
wrapper.between(ScrapApplication::getCreateTime, scrapApplication.getStartTime(), scrapApplication.getEndTime()); |
||||||
|
} |
||||||
|
wrapper.orderByDesc(ScrapApplication::getCreateTime); |
||||||
|
IPage<ScrapApplication> page = scrapApplicationService.page(Condition.getPage(query), wrapper); |
||||||
|
return R.data(page); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改 |
||||||
|
*/ |
||||||
|
@PostMapping("/update") |
||||||
|
public R update(@RequestBody ScrapApplication scrapApplication){ |
||||||
|
// 确认
|
||||||
|
if (scrapApplication.getStatus() == 1) { |
||||||
|
// 发送提示消息
|
||||||
|
messageClient.event(SysTypeEnum.INFORM.getValue(), "报修审核", |
||||||
|
"您有新的报修申请单待审核,请及时处理", 1, 5, "1555122570980995073","/repair/proposer"); |
||||||
|
scrapApplication.setApplyDeptUser(AuthUtil.getUserId()); |
||||||
|
scrapApplication.setApplyDeptUserName(AuthUtil.getUserName()); |
||||||
|
scrapApplication.setApplyDate(new Date()); |
||||||
|
} |
||||||
|
// 审核
|
||||||
|
if (scrapApplication.getStatus() == 2) { |
||||||
|
// 发送提示消息
|
||||||
|
messageClient.event(SysTypeEnum.INFORM.getValue(), "报修审批", |
||||||
|
"您有新的报修申请单待审批,请及时处理", 1, 5, "1552118581265973249","/repair/proposer"); |
||||||
|
scrapApplication.setReviewDate(new Date()); |
||||||
|
scrapApplication.setBusinessOfficeId(AuthUtil.getUserId()); |
||||||
|
scrapApplication.setBusinessOfficeName(AuthUtil.getUserName()); |
||||||
|
} |
||||||
|
// 审批
|
||||||
|
if (scrapApplication.getStatus() == 3) { |
||||||
|
scrapApplication.setApprovalDate(new Date()); |
||||||
|
scrapApplication.setCenterDirectorId(AuthUtil.getUserId()); |
||||||
|
scrapApplication.setCenterDirectorName(AuthUtil.getUserName()); |
||||||
|
// 修改设备状态为已报废
|
||||||
|
Instrument instrument = new Instrument(); |
||||||
|
instrument.setId(scrapApplication.getInstrumentId()); |
||||||
|
instrument.setInstrumentStatus("4"); |
||||||
|
instrumentService.updateById(instrument); |
||||||
|
} |
||||||
|
return R.status(scrapApplicationService.updateById(scrapApplication)); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
|
||||||
|
package org.springblade.lims.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.springblade.lims.entry.RepairApplication; |
||||||
|
import org.springblade.lims.entry.ScrapApplication; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author swj |
||||||
|
* @since 2022年6月2日15:47:39 |
||||||
|
*/ |
||||||
|
public interface ScrapApplicationMapper extends BaseMapper<ScrapApplication> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
|
||||||
|
package org.springblade.lims.service; |
||||||
|
|
||||||
|
import org.springblade.core.mp.base.BaseService; |
||||||
|
import org.springblade.lims.entry.RepairApplication; |
||||||
|
import org.springblade.lims.entry.ScrapApplication; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author swj |
||||||
|
* @since 2022年6月1日19:50:34 |
||||||
|
*/ |
||||||
|
public interface IScrapApplicationService extends BaseService<ScrapApplication> { |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
|
||||||
|
package org.springblade.lims.service.impl; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.lims.entry.RepairApplication; |
||||||
|
import org.springblade.lims.entry.ScrapApplication; |
||||||
|
import org.springblade.lims.mapper.RepairApplicationMapper; |
||||||
|
import org.springblade.lims.mapper.ScrapApplicationMapper; |
||||||
|
import org.springblade.lims.service.IRepairApplicationService; |
||||||
|
import org.springblade.lims.service.IScrapApplicationService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author swj |
||||||
|
* @since 2022年6月2日15:53:01 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@AllArgsConstructor |
||||||
|
public class ScrapApplicationServiceImpl extends BaseServiceImpl<ScrapApplicationMapper, ScrapApplication> implements IScrapApplicationService { |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue