Commit a28c9c41 authored by 竹天卫's avatar 竹天卫

功能bug修改

parent 02b60fd2
...@@ -302,12 +302,13 @@ public class EquipmentController { ...@@ -302,12 +302,13 @@ public class EquipmentController {
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "brand", value = "设备品牌", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "brand", value = "设备品牌", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "supplierId", value = "供应商表id", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "supplierId", value = "供应商表id", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "name", value = "设备名称", paramType = "query", dataType = "String") @ApiImplicitParam(name = "name", value = "设备名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "code", value = "设备编号", paramType = "query", dataType = "String")
}) })
@GetMapping("/getUsePage") @GetMapping("/getUsePage")
public BaseResponse getUsePage(PageQuery pageQuery, String brand, Integer supplierId, String name) { public BaseResponse getUsePage(PageQuery pageQuery, String brand, Integer supplierId, String name, String code) {
try { try {
return equipmentService.getUsePage(pageQuery, brand, supplierId, name); return equipmentService.getUsePage(pageQuery, brand, supplierId, name, code);
} catch (Exception e) { } catch (Exception e) {
log.debug("设备使用记录分页列表{}", e); log.debug("设备使用记录分页列表{}", e);
} }
...@@ -316,9 +317,9 @@ public class EquipmentController { ...@@ -316,9 +317,9 @@ public class EquipmentController {
@ApiOperation("设备使用记录导出") @ApiOperation("设备使用记录导出")
@PostMapping("/exportUse") @PostMapping("/exportUse")
public void exportUse(String brand, Integer supplierId, String name, String fileName, HttpServletResponse response) { public void exportUse(String brand, Integer supplierId, String name, String code, String fileName, HttpServletResponse response) {
try { try {
equipmentService.exportUse(brand, supplierId, name, fileName, response); equipmentService.exportUse(brand, supplierId, name, code, fileName, response);
} catch (Exception e) { } catch (Exception e) {
log.debug("设备使用记录导出{}", e); log.debug("设备使用记录导出{}", e);
} }
......
...@@ -3,6 +3,7 @@ package cn.wise.sc.cement.business.controller; ...@@ -3,6 +3,7 @@ package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery; import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery;
import cn.wise.sc.cement.business.model.query.PlanFinishQuery;
import cn.wise.sc.cement.business.model.query.TeamQuery; import cn.wise.sc.cement.business.model.query.TeamQuery;
import cn.wise.sc.cement.business.service.IPlanEquipmentPurchaseService; import cn.wise.sc.cement.business.service.IPlanEquipmentPurchaseService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -93,9 +94,9 @@ public class PlanEquipmentPurchaseController { ...@@ -93,9 +94,9 @@ public class PlanEquipmentPurchaseController {
@ApiOperation(value = "采购完成") @ApiOperation(value = "采购完成")
@PostMapping("/finish") @PostMapping("/finish")
public BaseResponse finish(Integer id) { public BaseResponse finish(PlanFinishQuery query) {
try { try {
return equipmentPurchaseService.finish(id); return equipmentPurchaseService.finish(query);
} catch (Exception e) { } catch (Exception e) {
log.debug("采购完成{}", e); log.debug("采购完成{}", e);
} }
......
...@@ -5,7 +5,9 @@ import cn.wise.sc.cement.business.entity.SysPost; ...@@ -5,7 +5,9 @@ import cn.wise.sc.cement.business.entity.SysPost;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.PostQuery; import cn.wise.sc.cement.business.model.query.PostQuery;
import cn.wise.sc.cement.business.model.query.SupplierEnclosureQuery;
import cn.wise.sc.cement.business.model.query.SupplierQuery; import cn.wise.sc.cement.business.model.query.SupplierQuery;
import cn.wise.sc.cement.business.model.query.SysUserEnclosureQuery;
import cn.wise.sc.cement.business.service.ISupplierService; import cn.wise.sc.cement.business.service.ISupplierService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -111,5 +113,38 @@ public class SupplierController { ...@@ -111,5 +113,38 @@ public class SupplierController {
return BaseResponse.errorMsg("失败!"); return BaseResponse.errorMsg("失败!");
} }
@ApiOperation(value = "上传附件")
@PostMapping("/upload")
public BaseResponse uploadPeoplePF(@RequestBody SupplierEnclosureQuery query){
try {
return supplierService.upload(query);
}catch (Exception e){
log.debug("上传附件{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "附件分页列表")
@GetMapping("/getEnclosurePage")
public BaseResponse getEnclosurePage(PageQuery pageQuery, Integer userId) {
try {
return supplierService.getEnclosurePage(pageQuery, userId);
} catch (Exception e) {
log.debug("附件分页列表{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "删除附件")
@PostMapping("/deleteEnclosure")
public BaseResponse deleteEnclosure(Integer id) {
try {
return supplierService.deleteEnclosure(id);
} catch (Exception e) {
log.debug("删除附件{}", e);
}
return BaseResponse.errorMsg("失败!");
}
} }
package cn.wise.sc.cement.business.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author ztw
* @since 2020-11-21
*/
@RestController
@RequestMapping("/business/supplier-enclosure")
public class SupplierEnclosureController {
}
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDate; import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -55,10 +56,17 @@ public class Consumables implements Serializable { ...@@ -55,10 +56,17 @@ public class Consumables implements Serializable {
@ApiModelProperty("采购日期(购买日期)") @ApiModelProperty("采购日期(购买日期)")
private LocalDate purchaseDate; private LocalDate purchaseDate;
@ApiModelProperty("库存数量") @ApiModelProperty("库存数量 单位:g")
private BigDecimal stockNum; private BigDecimal stockNum;
@ApiModelProperty("库存提醒数量(少于多少进行提醒)") @ApiModelProperty("入库数量 (单位:瓶)")
@TableField(exist = false)
private Integer enterNum;
@ApiModelProperty("多少g/瓶")
private BigDecimal unitStock;
@ApiModelProperty("库存提醒数量(少于多少g进行提醒)")
private BigDecimal leastNum; private BigDecimal leastNum;
@ApiModelProperty("有效日期") @ApiModelProperty("有效日期")
......
...@@ -40,8 +40,8 @@ public class ConsumablesEnter implements Serializable { ...@@ -40,8 +40,8 @@ public class ConsumablesEnter implements Serializable {
@ApiModelProperty("操作人id") @ApiModelProperty("操作人id")
private Integer userId; private Integer userId;
@ApiModelProperty("新增数量") @ApiModelProperty("新增数量")
private BigDecimal enterNum; private Integer enterNum;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
......
...@@ -67,6 +67,9 @@ public class PlanEquipmentPurchase implements Serializable { ...@@ -67,6 +67,9 @@ public class PlanEquipmentPurchase implements Serializable {
@ApiModelProperty("状态(0待采购,1已完成)") @ApiModelProperty("状态(0待采购,1已完成)")
private Integer status; private Integer status;
@ApiModelProperty("实施情况")
private String implementation;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
......
...@@ -49,6 +49,9 @@ public class Standard implements Serializable { ...@@ -49,6 +49,9 @@ public class Standard implements Serializable {
@ApiModelProperty("购买厂商(经销单位)") @ApiModelProperty("购买厂商(经销单位)")
private String supplierName; private String supplierName;
@ApiModelProperty("生产日期")
private LocalDate productionDate;
@ApiModelProperty("进样日期") @ApiModelProperty("进样日期")
private LocalDate purchaseDate; private LocalDate purchaseDate;
...@@ -58,13 +61,16 @@ public class Standard implements Serializable { ...@@ -58,13 +61,16 @@ public class Standard implements Serializable {
@ApiModelProperty("存储位置") @ApiModelProperty("存储位置")
private String position; private String position;
@ApiModelProperty("库存数量") @ApiModelProperty("库存数量 (单位:g)")
private BigDecimal stockNum; private BigDecimal stockNum;
@ApiModelProperty("多少g/瓶")
private BigDecimal unitStock;
@ApiModelProperty("库存提醒数量(少于多少进行提醒)") @ApiModelProperty("库存提醒数量(少于多少进行提醒)")
private BigDecimal leastNum; private BigDecimal leastNum;
@ApiModelProperty("状态(0已作废,1启用中)") @ApiModelProperty("状态(0已作废,1有效)")
private Integer status; private Integer status;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
......
...@@ -9,6 +9,7 @@ import java.time.LocalDateTime; ...@@ -9,6 +9,7 @@ import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -40,8 +41,8 @@ public class StandardEnter implements Serializable { ...@@ -40,8 +41,8 @@ public class StandardEnter implements Serializable {
@ApiModelProperty("操作人id") @ApiModelProperty("操作人id")
private Integer userId; private Integer userId;
@ApiModelProperty("新增数量") @ApiModelProperty("新增数量(单位: 瓶)")
private BigDecimal enterNum; private Integer enterNum;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
......
package cn.wise.sc.cement.business.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author ztw
* @since 2020-11-21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SupplierEnclosure implements Serializable {
private static final long serialVersionUID=1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 用户id
*/
private Integer supplierId;
/**
* 附件地址
*/
private String enclosureUrl;
/**
* 文件名
*/
private String alias;
/**
* 扩展名
*/
private String extName;
/**
* 状态(0未成功 1成功)
*/
private Integer flStatus;
/**
* 上传时间
*/
private LocalDateTime uploadTime;
}
package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.SupplierEnclosure;
import cn.wise.sc.cement.business.entity.SysUserEnclosure;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* <p>
* Mapper 接口
* </p>
*
* @author ztw
* @since 2020-11-21
*/
public interface SupplierEnclosureMapper extends BaseMapper<SupplierEnclosure> {
IPage<SupplierEnclosure> getPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
}
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
<if test="params.name != null and params.name != ''"> <if test="params.name != null and params.name != ''">
and e.name like concat('%', #{params.name}, '%') and e.name like concat('%', #{params.name}, '%')
</if> </if>
<if test="params.code != null and params.code != ''">
and e.code = #{params.code}
</if>
</where> </where>
</sql> </sql>
......
<?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="cn.wise.sc.cement.business.mapper.SupplierEnclosureMapper">
<select id="getPage" resultType="cn.wise.sc.cement.business.entity.SupplierEnclosure">
select se.*
from supplier_enclosure se
<if test="params.supplierId != null">
where se.supplier_id = #{params.supplierId}
</if>
</select>
</mapper>
...@@ -24,8 +24,11 @@ public class ChangeStockQuery { ...@@ -24,8 +24,11 @@ public class ChangeStockQuery {
/** /**
* 新增数量 / 领用数量 * 新增数量 / 领用数量
*/ */
@ApiModelProperty("改变数量") @ApiModelProperty("入库数量(单位 瓶)")
private BigDecimal changeNum; private Integer enterNum;
@ApiModelProperty("领用数量(单位 g)")
private BigDecimal outNum;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
......
package cn.wise.sc.cement.business.model.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
/**
* @description:
* @author: qh
* @create: 2020-09-29
**/
@Data
@ApiModel("完成-设备采购计划请求")
public class PlanFinishQuery {
private Integer id;
@ApiModelProperty("实施情况")
private String implementation;
}
...@@ -2,6 +2,7 @@ package cn.wise.sc.cement.business.model.query; ...@@ -2,6 +2,7 @@ package cn.wise.sc.cement.business.model.query;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -32,6 +33,9 @@ public class StandardQuery { ...@@ -32,6 +33,9 @@ public class StandardQuery {
@ApiModelProperty("购买厂商(经销单位)") @ApiModelProperty("购买厂商(经销单位)")
private String supplierName; private String supplierName;
@ApiModelProperty("生产日期")
private LocalDate productionDate;
@ApiModelProperty("进样日期") @ApiModelProperty("进样日期")
private LocalDate purchaseDate; private LocalDate purchaseDate;
...@@ -41,11 +45,14 @@ public class StandardQuery { ...@@ -41,11 +45,14 @@ public class StandardQuery {
@ApiModelProperty("存储位置") @ApiModelProperty("存储位置")
private String position; private String position;
@ApiModelProperty("库存数量") @ApiModelProperty("入库数量 (单位:瓶)")
private BigDecimal stockNum; private Integer enterNum;
@ApiModelProperty("多少g/瓶")
private BigDecimal unitStock;
@ApiModelProperty("库存提醒数量(少于多少进行提醒)") @ApiModelProperty("库存提醒数量(少于多少进行提醒)")
private BigDecimal leastNum; private Integer leastNum;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
......
package cn.wise.sc.cement.business.model.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @description: 人员管理附件
* @author: wlb
* @create: 2020-10-19
**/
@Data
@ApiModel("供应商管理附件")
public class SupplierEnclosureQuery {
@ApiModelProperty("供应商id")
private Integer supplierId;
@ApiModelProperty("文件名")
private String alias;
@ApiModelProperty("扩展名")
private String extName;
@ApiModelProperty("路径")
private String enclosureUrl;
}
...@@ -60,8 +60,8 @@ public interface IEquipmentService extends IService<Equipment> { ...@@ -60,8 +60,8 @@ public interface IEquipmentService extends IService<Equipment> {
BaseResponse<EquipmentScrapVo> getscrapApprovalDetail(Integer id); BaseResponse<EquipmentScrapVo> getscrapApprovalDetail(Integer id);
BaseResponse<IPage<EquipmentUseVo>> getUsePage(PageQuery pageQuery, BaseResponse<IPage<EquipmentUseVo>> getUsePage(PageQuery pageQuery,
String brand, Integer supplierId, String name); String brand, Integer supplierId, String name,String code);
void exportUse(String brand, Integer supplierId, String name, String fileName, HttpServletResponse response); void exportUse(String brand, Integer supplierId, String name, String code, String fileName, HttpServletResponse response);
} }
...@@ -4,6 +4,7 @@ import cn.wise.sc.cement.business.entity.PlanEquipmentPurchase; ...@@ -4,6 +4,7 @@ import cn.wise.sc.cement.business.entity.PlanEquipmentPurchase;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery; import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery;
import cn.wise.sc.cement.business.model.query.PlanFinishQuery;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo; import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
...@@ -30,7 +31,7 @@ public interface IPlanEquipmentPurchaseService extends IService<PlanEquipmentPur ...@@ -30,7 +31,7 @@ public interface IPlanEquipmentPurchaseService extends IService<PlanEquipmentPur
BaseResponse<PlanEquipmentPurchaseVo> getDetail(Integer id); BaseResponse<PlanEquipmentPurchaseVo> getDetail(Integer id);
BaseResponse<String> finish(Integer id); BaseResponse<String> finish(PlanFinishQuery query);
BaseResponse<String> delete(Integer id); BaseResponse<String> delete(Integer id);
......
...@@ -42,6 +42,8 @@ public interface IStandardService extends IService<Standard> { ...@@ -42,6 +42,8 @@ public interface IStandardService extends IService<Standard> {
BaseResponse<String> out(ChangeStockQuery query); BaseResponse<String> out(ChangeStockQuery query);
BaseResponse<String> checkStockNum();
BaseResponse<String> changeValidDate(ChangeValidDateQuery query); BaseResponse<String> changeValidDate(ChangeValidDateQuery query);
BaseResponse<String> overdue(Integer id); BaseResponse<String> overdue(Integer id);
......
package cn.wise.sc.cement.business.service;
import cn.wise.sc.cement.business.entity.SupplierEnclosure;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author ztw
* @since 2020-11-21
*/
public interface ISupplierEnclosureService extends IService<SupplierEnclosure> {
}
package cn.wise.sc.cement.business.service; package cn.wise.sc.cement.business.service;
import cn.wise.sc.cement.business.entity.Supplier; import cn.wise.sc.cement.business.entity.Supplier;
import cn.wise.sc.cement.business.entity.SupplierEnclosure;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.SupplierQuery; import cn.wise.sc.cement.business.model.query.SupplierQuery;
import cn.wise.sc.cement.business.model.query.SupplierEnclosureQuery;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
...@@ -23,4 +25,10 @@ public interface ISupplierService extends IService<Supplier> { ...@@ -23,4 +25,10 @@ public interface ISupplierService extends IService<Supplier> {
BaseResponse<Supplier> update(SupplierQuery query); BaseResponse<Supplier> update(SupplierQuery query);
BaseResponse<String> upload(SupplierEnclosureQuery query);
BaseResponse<IPage<SupplierEnclosure>> getEnclosurePage(PageQuery pageQuery, Integer supplierId);
BaseResponse<String> deleteEnclosure(Integer id);
} }
...@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -135,6 +136,12 @@ public class ConsumablesServiceImpl extends ServiceImpl<ConsumablesMapper, Consu ...@@ -135,6 +136,12 @@ public class ConsumablesServiceImpl extends ServiceImpl<ConsumablesMapper, Consu
if (count > 0) { if (count > 0) {
return BaseResponse.errorMsg(query.getName() + "已存在"); return BaseResponse.errorMsg(query.getName() + "已存在");
} }
if(query.getEnterNum() != null && query.getUnitStock() != null){
BigDecimal stockNum = new BigDecimal(query.getEnterNum()).multiply(query.getUnitStock());
query.setStockNum(stockNum);
}else{
query.setStockNum(new BigDecimal(0));
}
query.setCreateTime(LocalDateTime.now()) query.setCreateTime(LocalDateTime.now())
.setStatus(1); .setStatus(1);
consumablesMapper.insert(query); consumablesMapper.insert(query);
...@@ -143,7 +150,7 @@ public class ConsumablesServiceImpl extends ServiceImpl<ConsumablesMapper, Consu ...@@ -143,7 +150,7 @@ public class ConsumablesServiceImpl extends ServiceImpl<ConsumablesMapper, Consu
ConsumablesEnter enter = new ConsumablesEnter(); ConsumablesEnter enter = new ConsumablesEnter();
enter.setConsumablesId(query.getId()) enter.setConsumablesId(query.getId())
.setUserId(loginUser.getId()) .setUserId(loginUser.getId())
.setEnterNum(query.getStockNum()) .setEnterNum(query.getEnterNum())
.setCreateTime(LocalDateTime.now()) .setCreateTime(LocalDateTime.now())
.setRemark("新增消耗品"); .setRemark("新增消耗品");
consumablesEnterMapper.insert(enter); consumablesEnterMapper.insert(enter);
...@@ -192,11 +199,11 @@ public class ConsumablesServiceImpl extends ServiceImpl<ConsumablesMapper, Consu ...@@ -192,11 +199,11 @@ public class ConsumablesServiceImpl extends ServiceImpl<ConsumablesMapper, Consu
ConsumablesEnter enter = new ConsumablesEnter(); ConsumablesEnter enter = new ConsumablesEnter();
enter.setConsumablesId(consumables.getId()) enter.setConsumablesId(consumables.getId())
.setUserId(userService.getLoginUser().getId()) .setUserId(userService.getLoginUser().getId())
.setEnterNum(query.getChangeNum()) .setEnterNum(query.getEnterNum())
.setCreateTime(LocalDateTime.now()) .setCreateTime(LocalDateTime.now())
.setRemark(query.getRemark()); .setRemark(query.getRemark());
consumablesEnterMapper.insert(enter); consumablesEnterMapper.insert(enter);
consumables.setStockNum(consumables.getStockNum().add(enter.getEnterNum())); consumables.setStockNum(consumables.getStockNum().add( consumables.getUnitStock().multiply(new BigDecimal(enter.getEnterNum()))));
consumablesMapper.updateById(consumables); consumablesMapper.updateById(consumables);
return BaseResponse.okData("新增入库完成"); return BaseResponse.okData("新增入库完成");
} }
...@@ -220,7 +227,7 @@ public class ConsumablesServiceImpl extends ServiceImpl<ConsumablesMapper, Consu ...@@ -220,7 +227,7 @@ public class ConsumablesServiceImpl extends ServiceImpl<ConsumablesMapper, Consu
ConsumablesOut out = new ConsumablesOut(); ConsumablesOut out = new ConsumablesOut();
out.setConsumablesId(consumables.getId()) out.setConsumablesId(consumables.getId())
.setUserId(userService.getLoginUser().getId()) .setUserId(userService.getLoginUser().getId())
.setCollectNum(query.getChangeNum()) .setCollectNum(query.getOutNum())
.setCreateTime(LocalDateTime.now()) .setCreateTime(LocalDateTime.now())
.setRemark(query.getRemark()); .setRemark(query.getRemark());
consumablesOutMapper.insert(out); consumablesOutMapper.insert(out);
......
...@@ -308,9 +308,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -308,9 +308,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
//当前日期 //当前日期
LocalDate nowDate = LocalDate.now(); LocalDate nowDate = LocalDate.now();
for(Equipment eq : equipmentList ){ for(Equipment eq : equipmentList ){
//检定到期日期 = 上次检定日期+周期的值 - 7 (提前一周提醒) //检定到期日期 = 上次检定日期+周期的值 - 一个月 (提前一一个月提醒)
if(eq.getTestDate() != null && eq.getTestCycle() != null){ if(eq.getTestDate() != null && eq.getTestCycle() != null){
LocalDate expireDate = eq.getTestDate().plusYears(Long.valueOf(eq.getTestCycle())).minusWeeks(1); LocalDate expireDate = eq.getTestDate().plusYears(Long.valueOf(eq.getTestCycle())).minusMonths(1);
//如果当前日期等于检定到期日期 或者 当前日期大于检定到期日期,提示设备检定人员检定设备 //如果当前日期等于检定到期日期 或者 当前日期大于检定到期日期,提示设备检定人员检定设备
if(expireDate.isEqual(nowDate) || expireDate.isBefore(nowDate)){ if(expireDate.isEqual(nowDate) || expireDate.isBefore(nowDate)){
//发送企业微信消息内容 //发送企业微信消息内容
...@@ -501,6 +501,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -501,6 +501,9 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
} else { } else {
scrapMapper.updateById(equipmentScrap); scrapMapper.updateById(equipmentScrap);
} }
Equipment eq = equipmentMapper.selectById(equipmentVo.getId());
eq.setStatus(0);
equipmentMapper.updateById(eq);
return BaseResponse.okData("设备报废申请完成"); return BaseResponse.okData("设备报废申请完成");
} }
...@@ -531,6 +534,13 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -531,6 +534,13 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
} }
equipment.setStatus(3);//报废状态 equipment.setStatus(3);//报废状态
equipmentMapper.updateById(equipment); equipmentMapper.updateById(equipment);
}else{
Equipment equipment = equipmentMapper.selectById(equipmentScrap.getEquipmentId());
if (equipment == null) {
return BaseResponse.errorMsg("信息错误!");
}
equipment.setStatus(1);//启用状态
equipmentMapper.updateById(equipment);
} }
return BaseResponse.okData("审批完成"); return BaseResponse.okData("审批完成");
} }
...@@ -630,11 +640,13 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -630,11 +640,13 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
*/ */
@Override @Override
public BaseResponse<IPage<EquipmentUseVo>> getUsePage(PageQuery pageQuery, public BaseResponse<IPage<EquipmentUseVo>> getUsePage(PageQuery pageQuery,
String brand, Integer supplierId, String name) { String brand, Integer supplierId, String name,
String code) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("brand", brand); params.put("brand", brand);
params.put("supplierId", supplierId); params.put("supplierId", supplierId);
params.put("name", name); params.put("name", name);
params.put("code", code);
Page<EquipmentUseVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize()); Page<EquipmentUseVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
IPage<EquipmentUseVo> pages = useMapper.getPage(page, params); IPage<EquipmentUseVo> pages = useMapper.getPage(page, params);
return BaseResponse.okData(pages); return BaseResponse.okData(pages);
...@@ -650,11 +662,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -650,11 +662,12 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
* @param response * @param response
*/ */
@Override @Override
public void exportUse(String brand, Integer supplierId, String name, String fileName, HttpServletResponse response) { public void exportUse(String brand, Integer supplierId, String name, String code, String fileName, HttpServletResponse response) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("brand", brand); params.put("brand", brand);
params.put("supplierId", supplierId); params.put("supplierId", supplierId);
params.put("name", name); params.put("name", name);
params.put("code", code);
List<Map<String, Object>> list = scrapMapper.exportList(params); List<Map<String, Object>> list = scrapMapper.exportList(params);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
Map<String, Object> map = list.get(0); Map<String, Object> map = list.get(0);
......
...@@ -8,6 +8,7 @@ import cn.wise.sc.cement.business.model.BaseResponse; ...@@ -8,6 +8,7 @@ import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser; import cn.wise.sc.cement.business.model.LoginUser;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery; import cn.wise.sc.cement.business.model.query.PlanEquipmentPurchaseQuery;
import cn.wise.sc.cement.business.model.query.PlanFinishQuery;
import cn.wise.sc.cement.business.model.query.RoleQuery; import cn.wise.sc.cement.business.model.query.RoleQuery;
import cn.wise.sc.cement.business.model.query.TeamQuery; import cn.wise.sc.cement.business.model.query.TeamQuery;
import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo; import cn.wise.sc.cement.business.model.vo.PlanEquipmentPurchaseVo;
...@@ -189,19 +190,20 @@ public class PlanEquipmentPurchaseServiceImpl extends ServiceImpl<PlanEquipmentP ...@@ -189,19 +190,20 @@ public class PlanEquipmentPurchaseServiceImpl extends ServiceImpl<PlanEquipmentP
/** /**
* 采购完成 * 采购完成
* *
* @param id * @param query
* @return * @return
*/ */
@Transactional @Transactional
@Override @Override
public BaseResponse<String> finish(Integer id) { public BaseResponse<String> finish(PlanFinishQuery query) {
if (id == null) { if (query == null || query.getId() == null) {
return BaseResponse.errorMsg("参数错误!"); return BaseResponse.errorMsg("参数错误!");
} }
PlanEquipmentPurchase pep = equipmentPurchaseMapper.selectById(id); PlanEquipmentPurchase pep = equipmentPurchaseMapper.selectById(query.getId());
if (pep == null) { if (pep == null) {
return BaseResponse.errorMsg("数据错误!"); return BaseResponse.errorMsg("数据错误!");
} }
pep.setImplementation(query.getImplementation());
pep.setStatus(1); //采购完成 pep.setStatus(1); //采购完成
equipmentPurchaseMapper.updateById(pep); equipmentPurchaseMapper.updateById(pep);
return BaseResponse.okData("采购完成"); return BaseResponse.okData("采购完成");
......
...@@ -3,10 +3,7 @@ package cn.wise.sc.cement.business.service.impl; ...@@ -3,10 +3,7 @@ package cn.wise.sc.cement.business.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.entity.*; import cn.wise.sc.cement.business.entity.*;
import cn.wise.sc.cement.business.mapper.EntityEnclosureMapper; import cn.wise.sc.cement.business.mapper.*;
import cn.wise.sc.cement.business.mapper.StandardEnterMapper;
import cn.wise.sc.cement.business.mapper.StandardMapper;
import cn.wise.sc.cement.business.mapper.StandardOutMapper;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser; import cn.wise.sc.cement.business.model.LoginUser;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
...@@ -19,6 +16,7 @@ import cn.wise.sc.cement.business.service.IStandardValueService; ...@@ -19,6 +16,7 @@ import cn.wise.sc.cement.business.service.IStandardValueService;
import cn.wise.sc.cement.business.service.ISysUserService; import cn.wise.sc.cement.business.service.ISysUserService;
import cn.wise.sc.cement.business.util.ExcelUtil; import cn.wise.sc.cement.business.util.ExcelUtil;
import cn.wise.sc.cement.business.util.ObjUtils; import cn.wise.sc.cement.business.util.ObjUtils;
import cn.wise.sc.cement.business.util.weixin.Global;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -28,6 +26,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -28,6 +26,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -35,6 +34,7 @@ import javax.annotation.Resource; ...@@ -35,6 +34,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -70,6 +70,11 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i ...@@ -70,6 +70,11 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
private CommonServiceImpl commonService; private CommonServiceImpl commonService;
@Autowired @Autowired
private ISampleCheckService iSampleCheckService; private ISampleCheckService iSampleCheckService;
@Resource
private SysApprovalMapper sysApprovalMapper;
@Autowired
private WeiXinService weiXinService;
/** /**
* 分页查询 * 分页查询
...@@ -156,6 +161,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i ...@@ -156,6 +161,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
if (loginUser == null) { if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号"); return BaseResponse.errorMsg("请登录账号");
} }
QueryWrapper<Standard> qw = new QueryWrapper<>(); QueryWrapper<Standard> qw = new QueryWrapper<>();
qw.eq("name", query.getName()); qw.eq("name", query.getName());
int count = standardMapper.selectCount(qw); int count = standardMapper.selectCount(qw);
...@@ -164,6 +170,12 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i ...@@ -164,6 +170,12 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
} }
Standard standard = new Standard(); Standard standard = new Standard();
BeanUtils.copyProperties(query, standard); BeanUtils.copyProperties(query, standard);
if(query.getEnterNum() != null && query.getUnitStock() != null){
BigDecimal stockNum = new BigDecimal(query.getEnterNum()).multiply(query.getUnitStock());
standard.setStockNum(stockNum);
}else{
standard.setStockNum(new BigDecimal(0));
}
standard.setStatus(1) standard.setStatus(1)
.setCreateTime(LocalDateTime.now()); .setCreateTime(LocalDateTime.now());
standardMapper.insert(standard); standardMapper.insert(standard);
...@@ -191,7 +203,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i ...@@ -191,7 +203,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
StandardEnter enter = new StandardEnter(); StandardEnter enter = new StandardEnter();
enter.setStandardId(standard.getId()) enter.setStandardId(standard.getId())
.setUserId(loginUser.getId()) .setUserId(loginUser.getId())
.setEnterNum(query.getStockNum()) .setEnterNum(query.getEnterNum()) //入库数量 多少瓶
.setCreateTime(LocalDateTime.now()) .setCreateTime(LocalDateTime.now())
.setRemark("新增标样"); .setRemark("新增标样");
standardEnterMapper.insert(enter); standardEnterMapper.insert(enter);
...@@ -225,6 +237,10 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i ...@@ -225,6 +237,10 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
} }
Standard standard = new Standard(); Standard standard = new Standard();
BeanUtils.copyProperties(query, standard); BeanUtils.copyProperties(query, standard);
if(query.getEnterNum() != null && query.getUnitStock() != null){
BigDecimal stockNum = new BigDecimal(query.getEnterNum()).multiply(query.getUnitStock());
standard.setStockNum(stockNum);
}
standardMapper.updateById(standard); standardMapper.updateById(standard);
//添加标准值 //添加标准值
if (query.getStandardValueQueryList() != null && query.getStandardValueQueryList().size() > 0) { if (query.getStandardValueQueryList() != null && query.getStandardValueQueryList().size() > 0) {
...@@ -329,12 +345,12 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i ...@@ -329,12 +345,12 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
StandardEnter enter = new StandardEnter(); StandardEnter enter = new StandardEnter();
enter.setStandardId(standard.getId()) enter.setStandardId(standard.getId())
.setUserId(userService.getLoginUser().getId()) .setUserId(userService.getLoginUser().getId())
.setEnterNum(query.getChangeNum()) .setEnterNum(query.getEnterNum())
.setCreateTime(LocalDateTime.now()) .setCreateTime(LocalDateTime.now())
.setRemark(query.getRemark()); .setRemark(query.getRemark());
standardEnterMapper.insert(enter); standardEnterMapper.insert(enter);
standard.setStockNum(standard.getStockNum().add(enter.getEnterNum())); standard.setStockNum(standard.getStockNum().add(standard.getUnitStock().multiply(new BigDecimal(query.getEnterNum()))));
standardMapper.updateById(standard); standardMapper.updateById(standard);
return BaseResponse.okData("新增入库完成"); return BaseResponse.okData("新增入库完成");
} }
...@@ -358,7 +374,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i ...@@ -358,7 +374,7 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
StandardOut out = new StandardOut(); StandardOut out = new StandardOut();
out.setStandardId(standard.getId()) out.setStandardId(standard.getId())
.setUserId(userService.getLoginUser().getId()) .setUserId(userService.getLoginUser().getId())
.setCollectNum(query.getChangeNum()) .setCollectNum(query.getOutNum())
.setCreateTime(LocalDateTime.now()) .setCreateTime(LocalDateTime.now())
.setRemark(query.getRemark()); .setRemark(query.getRemark());
standardOutMapper.insert(out); standardOutMapper.insert(out);
...@@ -367,6 +383,61 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i ...@@ -367,6 +383,61 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
return BaseResponse.okData("领用出库完成"); return BaseResponse.okData("领用出库完成");
} }
/**
* 判断标样数量是否小于设定的最小值 如果小于等于,进行提醒
* 判断标样是否快过期 过期前15天进行提醒
* @return
*/
@Override
@Scheduled(cron = "0 0 6 * * *")
public BaseResponse<String> checkStockNum(){
//消息推送
List<Integer> approvalIdList = sysApprovalMapper.getApprovalId("标样管理");
if (approvalIdList == null) {
return BaseResponse.errorMsg("标样管理信息错误");
}
String userIds = "";
for(Integer testEQId : approvalIdList ){
SysUser testEQUser = userService.getById(testEQId);
if(testEQUser == null){
return BaseResponse.errorMsg("设备检定信息错误");
}
if(StringUtils.isNotBlank(testEQUser.getWxId())){
userIds = userIds.equals("")?testEQUser.getWxId():userIds+"|"+testEQUser.getWxId();
}
}
QueryWrapper<Standard> qw = new QueryWrapper<>();
qw.eq("status",1);
List<Standard> standardList = standardMapper.selectList(qw);
//当前日期
LocalDate nowDate = LocalDate.now();
for(Standard st : standardList){
if(st.getLeastNum() != null && st.getStockNum() != null){
if(st.getStockNum().compareTo(st.getLeastNum())<1){
//发送企业微信消息内容
String content="你好!标样名称:"+st.getName()+",代号:"+st.getCode()+"的标样数量小于设定的最小值,新增标样数量后请及时更新系统,如果已新增完毕请前往\n" +
Global.systemUrl+"更新标样记录。";
System.out.println("**************************content**********************");
System.out.println(content);
weiXinService.sendTextMessage(userIds, content);
}
}
if(st.getValidDate() != null){
LocalDate expireDate = st.getValidDate().minusDays(15);
if(expireDate.isEqual(nowDate) || expireDate.isBefore(nowDate)){
//发送企业微信消息内容
String content="你好!标样名称:"+st.getName()+",代号:"+st.getCode()+"的标样即将过期,请尽快处理,如果已经处理,请前往\n" +
Global.systemUrl+"更新标样记录。";
System.out.println("**************************content**********************");
System.out.println(content);
weiXinService.sendTextMessage(userIds, content);
}
}
}
return BaseResponse.okMsg("成功");
}
/** /**
* 变更有效期 * 变更有效期
* *
......
package cn.wise.sc.cement.business.service.impl;
import cn.wise.sc.cement.business.entity.SupplierEnclosure;
import cn.wise.sc.cement.business.mapper.SupplierEnclosureMapper;
import cn.wise.sc.cement.business.service.ISupplierEnclosureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author ztw
* @since 2020-11-21
*/
@Service
public class SupplierEnclosureServiceImpl extends ServiceImpl<SupplierEnclosureMapper, SupplierEnclosure> implements ISupplierEnclosureService {
}
package cn.wise.sc.cement.business.service.impl; package cn.wise.sc.cement.business.service.impl;
import cn.wise.sc.cement.business.entity.Supplier; import cn.wise.sc.cement.business.entity.Supplier;
import cn.wise.sc.cement.business.entity.SysPost; import cn.wise.sc.cement.business.entity.SupplierEnclosure;
import cn.wise.sc.cement.business.entity.SysUserEnclosure;
import cn.wise.sc.cement.business.mapper.SupplierEnclosureMapper;
import cn.wise.sc.cement.business.mapper.SupplierMapper; import cn.wise.sc.cement.business.mapper.SupplierMapper;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser;
import cn.wise.sc.cement.business.model.PageQuery; import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.PostQuery;
import cn.wise.sc.cement.business.model.query.SupplierQuery; import cn.wise.sc.cement.business.model.query.SupplierQuery;
import cn.wise.sc.cement.business.model.query.SupplierEnclosureQuery;
import cn.wise.sc.cement.business.service.ISupplierService; import cn.wise.sc.cement.business.service.ISupplierService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jdk.nashorn.internal.ir.annotations.Reference;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -34,6 +39,10 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i ...@@ -34,6 +39,10 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
@Resource @Resource
private SupplierMapper supplierMapper; private SupplierMapper supplierMapper;
@Autowired
private UserServiceImpl userService;
@Resource
private SupplierEnclosureMapper supplierEnclosureMapper;
/** /**
* 获取分页 * 获取分页
...@@ -103,4 +112,71 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i ...@@ -103,4 +112,71 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
return BaseResponse.okData(supplier); return BaseResponse.okData(supplier);
} }
/**
* 新增供应商附件信息
* @param query
* @return
*/
@Override
@Transactional
public BaseResponse<String> upload(SupplierEnclosureQuery query) {
LoginUser loginUser = userService.getLoginUser();
if (loginUser == null) {
return BaseResponse.errorMsg("请登录账号");
}
if (query == null || query.getSupplierId() == null) {
return BaseResponse.errorMsg("参数错误");
}
SupplierEnclosure supplierEnclosure = new SupplierEnclosure();
supplierEnclosure.setSupplierId(query.getSupplierId())
.setEnclosureUrl(query.getEnclosureUrl())
.setExtName(query.getExtName())
.setAlias(query.getAlias())
.setFlStatus(1)
.setUploadTime(LocalDateTime.now());
supplierEnclosureMapper.insert(supplierEnclosure);
return BaseResponse.okMsg("成功");
}
/**
* 附件列表
* @param pageQuery
* @param supplierId
* @return
*/
@Override
public BaseResponse<IPage<SupplierEnclosure>> getEnclosurePage(PageQuery pageQuery, Integer supplierId) {
if(supplierId == null){
return BaseResponse.errorMsg("请传入供应商id");
}
Map<String, Object> params = new HashMap<>();
params.put("supplierId", supplierId);
Page<SupplierEnclosure> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
IPage<SupplierEnclosure> pages = supplierEnclosureMapper.getPage(page, params);
return BaseResponse.okData(pages);
}
/**
* 删除供应商附件
* @param id
* @return
*/
@Transactional
@Override
public BaseResponse<String> deleteEnclosure(Integer id) {
if(id == null){
return BaseResponse.errorMsg("参数错误");
}
SupplierEnclosure suppliernclosure = supplierEnclosureMapper.selectById(id);
if(suppliernclosure == null){
return BaseResponse.errorMsg("附件信息错误");
}
supplierEnclosureMapper.deleteById(id);
return BaseResponse.okData("附件信息删除成功");
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment