diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80d4b0f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/backend/target/ +/backend/.idea/ +/frontend/node_modules \ No newline at end of file diff --git a/backend/src/main/java/cc/mrbird/febs/cos/controller/StockInfoController.java b/backend/src/main/java/cc/mrbird/febs/cos/controller/StockInfoController.java index a42d5d4..6f9a733 100644 --- a/backend/src/main/java/cc/mrbird/febs/cos/controller/StockInfoController.java +++ b/backend/src/main/java/cc/mrbird/febs/cos/controller/StockInfoController.java @@ -9,11 +9,7 @@ import cc.mrbird.febs.cos.service.IStockPutService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; @@ -100,5 +96,16 @@ public class StockInfoController { return R.ok(); } + /** + * 根据月份获取药品统计情况 + * + * @param date 日期 + * @return 结果 + */ + @GetMapping("/selectStatisticsByMonth") + public R selectStatisticsByMonth(@RequestParam("date") String date) throws FebsException { + return R.ok(stockInfoService.selectStatisticsByMonth(date)); + } + } diff --git a/backend/src/main/java/cc/mrbird/febs/cos/dao/StockInfoMapper.java b/backend/src/main/java/cc/mrbird/febs/cos/dao/StockInfoMapper.java index 62d33c8..90e1213 100644 --- a/backend/src/main/java/cc/mrbird/febs/cos/dao/StockInfoMapper.java +++ b/backend/src/main/java/cc/mrbird/febs/cos/dao/StockInfoMapper.java @@ -1,5 +1,6 @@ package cc.mrbird.febs.cos.dao; +import cc.mrbird.febs.cos.entity.GoodsBelong; import cc.mrbird.febs.cos.entity.StockInfo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -37,4 +38,13 @@ public interface StockInfoMapper extends BaseMapper { // 本月数据统计 LinkedHashMap stockInfoByMonth(); + + /** + * 根据时间获取订单信息 + * + * @param year 年度 + * @param month 月度 + * @return 结果 + */ + List selectOrderByCheckMonth(@Param("year") Integer year, @Param("month") Integer month); } diff --git a/backend/src/main/java/cc/mrbird/febs/cos/entity/ArchivesInfo.java b/backend/src/main/java/cc/mrbird/febs/cos/entity/ArchivesInfo.java index e606578..855deee 100644 --- a/backend/src/main/java/cc/mrbird/febs/cos/entity/ArchivesInfo.java +++ b/backend/src/main/java/cc/mrbird/febs/cos/entity/ArchivesInfo.java @@ -96,4 +96,9 @@ public class ArchivesInfo implements Serializable { private String delFlag; private String userId; + + /** + * 提交材料 + */ + private String material; } diff --git a/backend/src/main/java/cc/mrbird/febs/cos/service/IStockInfoService.java b/backend/src/main/java/cc/mrbird/febs/cos/service/IStockInfoService.java index d516dbf..95ad1e8 100644 --- a/backend/src/main/java/cc/mrbird/febs/cos/service/IStockInfoService.java +++ b/backend/src/main/java/cc/mrbird/febs/cos/service/IStockInfoService.java @@ -33,4 +33,12 @@ public interface IStockInfoService extends IService { LinkedHashMap home(Integer type, Integer userId); boolean checkStock(List goodsBelongList); + + /** + * 根据月份获取药品统计情况 + * + * @param date 日期 + * @return 结果 + */ + LinkedHashMap selectStatisticsByMonth(String date) throws FebsException; } diff --git a/backend/src/main/java/cc/mrbird/febs/cos/service/impl/StockInfoServiceImpl.java b/backend/src/main/java/cc/mrbird/febs/cos/service/impl/StockInfoServiceImpl.java index 54bbbf2..fa33f78 100644 --- a/backend/src/main/java/cc/mrbird/febs/cos/service/impl/StockInfoServiceImpl.java +++ b/backend/src/main/java/cc/mrbird/febs/cos/service/impl/StockInfoServiceImpl.java @@ -9,6 +9,7 @@ import cc.mrbird.febs.cos.entity.StockPut; import cc.mrbird.febs.cos.service.*; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -22,9 +23,8 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * @author FanK @@ -165,4 +165,76 @@ public class StockInfoServiceImpl extends ServiceImpl selectStatisticsByMonth(String date) throws FebsException { + if (StrUtil.isEmpty(date)) { + throw new FebsException("参数不能为空"); + } + + int year = DateUtil.year(DateUtil.parseDate(date)); + int month = DateUtil.month(DateUtil.parseDate(date)) + 1; + + // 返回数据 + LinkedHashMap result = new LinkedHashMap() { + { + put("num", Collections.emptyList()); + put("price", Collections.emptyList()); + } + }; + + // 获取订单详情 + List orderList = baseMapper.selectOrderByCheckMonth(year, month); + if (CollectionUtil.isEmpty(orderList)) { + return result; + } + + List putOrderList = new ArrayList<>(); + List outOrderList = new ArrayList<>(); + + for (GoodsBelong goodsBelong : orderList) { + if (goodsBelong.getNum().contains("PUT-")) { + putOrderList.add(goodsBelong); + } + if (goodsBelong.getNum().contains("OUT-")) { + outOrderList.add(goodsBelong); + } + } + + Map> putOrderMap = putOrderList.stream().collect(Collectors.groupingBy(GoodsBelong::getName)); + Map> outOrderMap = outOrderList.stream().collect(Collectors.groupingBy(GoodsBelong::getName)); + + List> putNumMap = new ArrayList<>(); + List> outNumMap = new ArrayList<>(); + + putOrderMap.forEach((key, value) -> { + Map numItem = new HashMap() { + { + put("name", key); + put("value", value.stream().map(GoodsBelong::getAmount).reduce(Integer::sum)); + } + }; + putNumMap.add(numItem); + }); + + outOrderMap.forEach((key, value) -> { + Map numItem = new HashMap() { + { + put("name", key); + put("value", value.stream().map(GoodsBelong::getAmount).reduce(Integer::sum)); + } + }; + outNumMap.add(numItem); + }); + + result.put("putNumMap", putNumMap); + result.put("outNumMap", outNumMap); + return result; + } } diff --git a/backend/src/main/resources/mapper/cos/ArchivesInfoMapper.xml b/backend/src/main/resources/mapper/cos/ArchivesInfoMapper.xml index 595aded..0fb6a1e 100644 --- a/backend/src/main/resources/mapper/cos/ArchivesInfoMapper.xml +++ b/backend/src/main/resources/mapper/cos/ArchivesInfoMapper.xml @@ -19,7 +19,8 @@ mail, phone, create_date, - del_flag + del_flag, + material from archives_info where diff --git a/backend/src/main/resources/mapper/cos/StockInfoMapper.xml b/backend/src/main/resources/mapper/cos/StockInfoMapper.xml index fb17443..c849ceb 100644 --- a/backend/src/main/resources/mapper/cos/StockInfoMapper.xml +++ b/backend/src/main/resources/mapper/cos/StockInfoMapper.xml @@ -192,4 +192,15 @@ ( SELECT count( 1 ) AS outCount FROM stock_info si WHERE si.is_in = 2 ) AS on2, ( SELECT IFNULL( SUM( si.amount * si.price ),0) AS price FROM stock_info si WHERE si.is_in = 1 ) AS on3 + + + diff --git a/frontend/src/views/HomePage.vue b/frontend/src/views/HomePage.vue index d006c06..30226af 100644 --- a/frontend/src/views/HomePage.vue +++ b/frontend/src/views/HomePage.vue @@ -111,6 +111,28 @@ ]"/> + + + +
+ +
+ Upload +
+
+
+ + example + +
+
修改 @@ -140,6 +162,14 @@ import HeadInfo from '@/views/common/HeadInfo' import {mapState} from 'vuex' import moment from 'moment' moment.locale('zh-cn') +function getBase64 (file) { + return new Promise((resolve, reject) => { + const reader = new FileReader() + reader.readAsDataURL(file) + reader.onload = () => resolve(reader.result) + reader.onerror = error => reject(error) + }) +} const formItemLayout = { labelCol: { span: 24 }, @@ -150,6 +180,9 @@ export default { components: {HeadInfo}, data () { return { + fileList: [], + previewVisible: false, + previewImage: '', form: this.$form.createForm(this), formItemLayout, series6: [{ @@ -378,6 +411,28 @@ export default { } }, methods: { + handleCancel () { + this.previewVisible = false + }, + async handlePreview (file) { + if (!file.url && !file.preview) { + file.preview = await getBase64(file.originFileObj) + } + this.previewImage = file.url || file.preview + this.previewVisible = true + }, + picHandleChange ({ fileList }) { + this.fileList = fileList + }, + imagesInit (images) { + if (images !== null && images !== '') { + let imageList = [] + images.split(',').forEach((image, index) => { + imageList.push({uid: index, name: image, status: 'done', url: 'http://127.0.0.1:9527/imagesWeb/' + image}) + }) + this.fileList = imageList + } + }, welcome () { const date = new Date() const hour = date.getHours() @@ -389,6 +444,10 @@ export default { let fields = ['name', 'content', 'team'] let obj = {} Object.keys(combo).forEach((key) => { + if (key === 'material') { + this.fileList = [] + this.imagesInit(combo['material']) + } if (fields.indexOf(key) !== -1) { this.form.getFieldDecorator(key) obj[key] = combo[key] @@ -397,8 +456,17 @@ export default { this.form.setFieldsValue(obj) }, handleSubmit () { + let images = [] + this.fileList.forEach(image => { + if (image.response !== undefined) { + images.push(image.response) + } else { + images.push(image.name) + } + }) this.form.validateFields((err, values) => { if (!err) { + values.material = images.length > 0 ? images.join(',') : null values.id = this.studentInfo.id this.$put('/cos/archives-info', { ...values diff --git a/frontend/src/views/admin/statistics/Statistics.vue b/frontend/src/views/admin/statistics/Statistics.vue new file mode 100644 index 0000000..0b28569 --- /dev/null +++ b/frontend/src/views/admin/statistics/Statistics.vue @@ -0,0 +1,165 @@ + + + + + diff --git a/frontend/src/views/manage/archives/Archives.vue b/frontend/src/views/manage/archives/Archives.vue index e45c4f7..67f512f 100644 --- a/frontend/src/views/manage/archives/Archives.vue +++ b/frontend/src/views/manage/archives/Archives.vue @@ -231,6 +231,18 @@ export default { return '- -' } } + }, { + title: '材料文件', + dataIndex: 'material', + customRender: (text, record, index) => { + if (!record.material) return + return + + + + } }, { title: '创建时间', dataIndex: 'createDate',