Browse Source

[feat]基础信息:提交请购单列表信息,清除不需要的字段信息,对象新增获得部门、岗位、姓名的字段。

dev
zhangsiqi 6 months ago
parent
commit
666e4e5ba3
  1. 13
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseRequisitioningOrderController.java
  2. 29
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseRequisitioningOrder.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java
  4. 8
      ruoyi-admin/src/main/resources/templates/system/requisitioning/add.html
  5. 4
      ruoyi-admin/src/main/resources/templates/system/requisitioning/requisitioning.html

13
ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseRequisitioningOrderController.java

@ -21,11 +21,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IBaseRequisitioningOrderService; import com.ruoyi.system.service.IBaseRequisitioningOrderService;
@ -121,9 +117,10 @@ public class BaseRequisitioningOrderController extends BaseController
@Log(title = "请购单", businessType = BusinessType.INSERT) @Log(title = "请购单", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(BaseRequisitioningOrder baseRequisitioningOrder) public AjaxResult addSave(@RequestBody BaseRequisitioningOrder baseRequisitioningOrder)
{ {
return toAjax(baseRequisitioningOrderService.insertBaseRequisitioningOrder(baseRequisitioningOrder)); baseRequisitioningOrderService.insertBaseRequisitioningOrder(baseRequisitioningOrder);
return AjaxResult.success();
} }
/** /**
@ -144,7 +141,7 @@ public class BaseRequisitioningOrderController extends BaseController
@Log(title = "请购单", businessType = BusinessType.UPDATE) @Log(title = "请购单", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(BaseRequisitioningOrder baseRequisitioningOrder) public AjaxResult editSave(@RequestBody BaseRequisitioningOrder baseRequisitioningOrder)
{ {
return toAjax(baseRequisitioningOrderService.updateBaseRequisitioningOrder(baseRequisitioningOrder)); return toAjax(baseRequisitioningOrderService.updateBaseRequisitioningOrder(baseRequisitioningOrder));
} }

29
ruoyi-admin/src/main/java/com/ruoyi/system/domain/BaseRequisitioningOrder.java

@ -60,6 +60,35 @@ public class BaseRequisitioningOrder extends BaseEntity
/** 使用状态 */ /** 使用状态 */
private String useStatus; private String useStatus;
private String postName;
private String userName;
private String deptName;
public String getPostName() {
return postName;
}
public void setPostName(String postName) {
this.postName = postName;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
private List<BaseRequisitioningOrderChild> baseRequisitioningOrderChildList; private List<BaseRequisitioningOrderChild> baseRequisitioningOrderChildList;

6
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseRequisitioningOrderServiceImpl.java

@ -14,6 +14,7 @@ import com.ruoyi.system.mapper.BaseRequisitioningOrderMapper;
import com.ruoyi.system.domain.BaseRequisitioningOrder; import com.ruoyi.system.domain.BaseRequisitioningOrder;
import com.ruoyi.system.service.IBaseRequisitioningOrderService; import com.ruoyi.system.service.IBaseRequisitioningOrderService;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 请购单Service业务层处理 * 请购单Service业务层处理
@ -64,6 +65,7 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = NullPointerException.class)
public int insertBaseRequisitioningOrder(BaseRequisitioningOrder baseRequisitioningOrder) public int insertBaseRequisitioningOrder(BaseRequisitioningOrder baseRequisitioningOrder)
{ {
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
@ -71,12 +73,15 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr
baseRequisitioningOrder.setCreateTime(DateUtils.getNowDate()); baseRequisitioningOrder.setCreateTime(DateUtils.getNowDate());
baseRequisitioningOrder.setRequisitioningCode(redisCache.generateBillNo("QG")); baseRequisitioningOrder.setRequisitioningCode(redisCache.generateBillNo("QG"));
List<BaseRequisitioningOrderChild> childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList(); List<BaseRequisitioningOrderChild> childList = baseRequisitioningOrder.getBaseRequisitioningOrderChildList();
int childSize = childList.size();
if (childSize > 0) {
for (BaseRequisitioningOrderChild child : childList) { for (BaseRequisitioningOrderChild child : childList) {
child.setQuoteId(baseRequisitioningOrder.getRequisitioningCode()); child.setQuoteId(baseRequisitioningOrder.getRequisitioningCode());
child.setCreateBy(loginName); child.setCreateBy(loginName);
child.setCreateTime(DateUtils.getNowDate()); child.setCreateTime(DateUtils.getNowDate());
baseRequisitioningOrderChildMapper.insertBaseRequisitioningOrderChild(child); baseRequisitioningOrderChildMapper.insertBaseRequisitioningOrderChild(child);
} }
}
return baseRequisitioningOrderMapper.insertBaseRequisitioningOrder(baseRequisitioningOrder); return baseRequisitioningOrderMapper.insertBaseRequisitioningOrder(baseRequisitioningOrder);
} }
@ -87,6 +92,7 @@ public class BaseRequisitioningOrderServiceImpl implements IBaseRequisitioningOr
* @return 结果 * @return 结果
*/ */
@Override @Override
@Transactional(rollbackFor = NullPointerException.class)
public int updateBaseRequisitioningOrder(BaseRequisitioningOrder baseRequisitioningOrder) public int updateBaseRequisitioningOrder(BaseRequisitioningOrder baseRequisitioningOrder)
{ {
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();

8
ruoyi-admin/src/main/resources/templates/system/requisitioning/add.html

@ -11,13 +11,13 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">部门:</label> <label class="col-sm-3 control-label is-required">部门:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="dept" class="form-control" required></select> <select name="deptName" class="form-control" required></select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required" >岗位:</label> <label class="col-sm-3 control-label is-required" >岗位:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<select name="post" class="form-control" required></select> <select name="postName" class="form-control" required></select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -236,9 +236,9 @@
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
console.log(data); console.log(data);
$("select[name='dept']").append($('<option></option>').val(data.deptName).html(data.deptName)); $("select[name='deptName']").append($('<option></option>').val(data.deptName).html(data.deptName));
$("select[name='userName']").append($('<option></option>').val(data.userName).html(data.userName)); $("select[name='userName']").append($('<option></option>').val(data.userName).html(data.userName));
$("select[name='post']").append($('<option></option>').val(data.postName).html(data.postName)); $("select[name='postName']").append($('<option></option>').val(data.postName).html(data.postName));
} }
}); });

4
ruoyi-admin/src/main/resources/templates/system/requisitioning/requisitioning.html

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="include :: header('请购单列表')" /> <th:block th:include="include :: header('请购单列表')" />
<th:block th:include="include :: datetimepicker-css" />
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
@ -66,6 +67,9 @@
</div> </div>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:requisitioning:edit')}]]; var editFlag = [[${@permission.hasPermi('system:requisitioning:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:requisitioning:remove')}]]; var removeFlag = [[${@permission.hasPermi('system:requisitioning:remove')}]];

Loading…
Cancel
Save