Browse Source

update 乐保增加新搜索条件

周箭河 4 years ago
parent
commit
1b4056a283

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentInstrument.java

@@ -38,7 +38,7 @@ public class StudentInstrument {
      * 分类id
      */
     @ApiModelProperty(value = "商品分类名称")
-    private Integer goodsCategoryName;
+    private String goodsCategoryName;
 
     /**
      * 是否月保 0-不是 1-是
@@ -228,11 +228,11 @@ public class StudentInstrument {
         this.goodsCategoryId = goodsCategoryId;
     }
 
-    public Integer getGoodsCategoryName() {
+    public String getGoodsCategoryName() {
         return goodsCategoryName;
     }
 
-    public void setGoodsCategoryName(Integer goodsCategoryName) {
+    public void setGoodsCategoryName(String goodsCategoryName) {
         this.goodsCategoryName = goodsCategoryName;
     }
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentInstrumentService.java

@@ -23,4 +23,11 @@ public interface StudentInstrumentService extends BaseService<Long, StudentInstr
      * @return
      */
     Boolean orderCallback(StudentPaymentOrder studentPaymentOrder);
+
+    /**
+     * 添加学生乐器
+     * @param studentInstrument
+     * @return
+     */
+    StudentInstrument addStudentInstrument(StudentInstrument studentInstrument);
 }

+ 16 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java

@@ -3,10 +3,7 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.MaintenancePayDto;
-import com.ym.mec.biz.dal.entity.StudentInstrument;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
@@ -50,6 +47,8 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
     @Autowired
     private SysMessageService sysMessageService;
+    @Autowired
+    private GoodsService goodsService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -239,4 +238,17 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
         }
         return false;
     }
+
+    @Override
+    public StudentInstrument addStudentInstrument(StudentInstrument studentInstrument) {
+        Goods goods = goodsService.get(studentInstrument.getGoodsId());
+        studentInstrument.setGoodsCategoryId(goods.getGoodsCategoryId());
+        studentInstrument.setGoodsCategoryName(goods.getGoodsCategoryName());
+        studentInstrument.setGoodsName(goods.getName());
+        studentInstrument.setGoodsBrand(goods.getBrand());
+        studentInstrument.setSpecification(goods.getSpecification());
+        studentInstrument.setGoodsImg(goods.getImage());
+        studentInstrumentDao.insert(studentInstrument);
+        return studentInstrument;
+    }
 }

+ 15 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentInstrumentController.java

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.StudentInstrument;
 import com.ym.mec.biz.dal.page.StudentInstrumentQueryInfo;
 import com.ym.mec.biz.service.StudentInstrumentService;
@@ -62,4 +63,18 @@ public class StudentInstrumentController extends BaseController {
         return succeed(studentInstrumentService.queryPage(queryInfo));
     }
 
+    @ApiOperation(value = "新增乐器")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('studentInstrument/add')")
+    public HttpResponseResult<StudentInstrument> add(StudentInstrument studentInstrument) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed("用户信息获取失败");
+        }
+        if (studentInstrument.getStudentId() == null) {
+            return failed("学生id不能为空");
+        }
+        return succeed(studentInstrumentService.addStudentInstrument(studentInstrument));
+    }
+
 }