13 files modified
2 files added
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.desk.entity.Notice; |
| | | import org.springblade.modules.remote.wrapper.RemoteWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import org.springblade.modules.remote.vo.RemoteVO; |
| | | import org.springblade.modules.remote.service.IRemoteService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入remote") |
| | | public R<IPage<Remote>> list(Remote remote, Query query) { |
| | | IPage<Remote> pages = remoteService.page(Condition.getPage(query), Condition.getQueryWrapper(remote)); |
| | | return R.data(pages); |
| | | public R<IPage<RemoteVO>> list(@ApiIgnore @RequestParam Map<String, Object> remote, Query query) { |
| | | //IPage<Remote> pages = remoteService.page(Condition.getPage(query), Condition.getQueryWrapper(remote)); |
| | | IPage<Remote> pages = remoteService.page(Condition.getPage(query), Condition.getQueryWrapper(remote, Remote.class)); |
| | | return R.data(RemoteWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.springblade.core.mp.base.BaseEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | /** |
| | | * 实体类 |
| | |
| | | * 遥感地址 |
| | | */ |
| | | private String reUrl; |
| | | /** |
| | | * 遥感时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date reTime; |
| | | /** |
| | | * 是否展示 |
| | | */ |
| | | private String reType; |
| | | /** |
| | | * 拍摄时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date releaseTime; |
| | | /** |
| | | * 介绍 |
| | | */ |
| | | private String reContext; |
| | | /** |
| | | * 图片 |
| | | */ |
| | | private String reTp; |
| | | |
| | | |
| | | } |
| | |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="status" property="status"/> |
| | | <result column="is_deleted" property="isDeleted"/> |
| | | <result column=" |
| | | |
| | | re_name" property=" |
| | | |
| | | reName"/> |
| | | <result column=" |
| | | |
| | | re_url" property=" |
| | | |
| | | reUrl"/> |
| | | <result column="re_name" property="reName"/> |
| | | <result column="re_url" property="reUrl"/> |
| | | <result column="re_time" property="reTime"/> |
| | | <result column="re_type" property="reType"/> |
| | | <result column="re_ptime" property="rePtime"/> |
| | | <result column="re_context" property="reContext"/> |
| | | <result column="re_tp" property="reTp"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="selectRemotePage" resultMap="remoteResultMap"> |
| | | select * from sys_remote where is_deleted = 0 |
| | | select * |
| | | from sys_remote |
| | | where is_deleted = 0 |
| | | </select> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.remote.wrapper; |
| | | |
| | | import org.springblade.common.cache.DictCache; |
| | | import org.springblade.common.enums.DictEnum; |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.desk.entity.Notice; |
| | | import org.springblade.modules.desk.vo.NoticeVO; |
| | | import org.springblade.modules.remote.entity.Remote; |
| | | import org.springblade.modules.remote.vo.RemoteVO; |
| | | |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * Notice包装类,返回视图层所需的字段 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public class RemoteWrapper extends BaseEntityWrapper<Remote, RemoteVO> { |
| | | |
| | | public static RemoteWrapper build() { |
| | | return new RemoteWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public RemoteVO entityVO(Remote remote) { |
| | | RemoteVO remoteVO = Objects.requireNonNull(BeanUtil.copy(remote, RemoteVO.class)); |
| | | return remoteVO; |
| | | } |
| | | |
| | | /** |
| | | * 查询条件处理 |
| | | */ |
| | | public void noticeQuery(Map<String, Object> notice) { |
| | | // 此场景仅在 pg数据库 map类型传参的情况下需要处理,entity传参已经包含数据类型,则无需关心 |
| | | // 针对 pg数据库 int类型字段查询需要强转的处理示例 |
| | | String searchKey = "category"; |
| | | if (Func.isNotEmpty(notice.get(searchKey))) { |
| | | // 数据库字段为int类型,设置"="查询,具体查询参数请见 @org.springblade.core.mp.support.SqlKeyword |
| | | notice.put(searchKey.concat("_equal"), Func.toInt(notice.get(searchKey))); |
| | | // 默认"like"查询,pg数据库 场景会报错,所以将其删除 |
| | | notice.remove(searchKey); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | <select id="selectSoldrPage" resultMap="soldrResultMap"> |
| | | select * from sys_soldr where is_deleted = 0 |
| | | select * |
| | | from sys_soldr |
| | | where is_deleted = 0 |
| | | </select> |
| | | |
| | | <select id="selectLists" resultType="org.springblade.modules.soldr.vo.SoldrVO"> |
| | | SELECT st.stock_id1, |
| | | st.specs1, |
| | | st.sid, |
| | | st.amount1 AS amount1, |
| | | stf.factory_name AS factoryName, |
| | | a.dict_value AS stype, |
| | |
| | | </select> |
| | | |
| | | <delete id="del"> |
| | | delete from sys_soldr where sid=#{id} |
| | | delete |
| | | from sys_soldr |
| | | where sid = #{id} |
| | | </delete> |
| | | </mapper> |
| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.stock.vo.StocksVO; |
| | | import org.springblade.modules.stockrecord.entity.Stockrecord; |
| | | import org.springblade.modules.stockrecord.service.IStockrecordService; |
| | | import org.springblade.modules.system.entity.DictBiz; |
| | |
| | | |
| | | private final IStockService stockService; |
| | | private final IStockrecordService stockrecordService; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | |
| | | stockrecord.setSpecsVal2(stock.getSpecsValue2()); |
| | | stockrecord.setSp1("stockSpecs1"); |
| | | stockrecord.setSp2("stockSpecs2"); |
| | | //统计公斤 |
| | | Integer amount = stock.getAmount(); |
| | | Integer specsValue1 = stock.getSpecsValue1(); |
| | | double v = 0; |
| | | //克 |
| | | if (specsValue1 == 0) { |
| | | v = amount * 0.001; |
| | | } |
| | | //斤 |
| | | if (specsValue1 == 1) { |
| | | v = amount * 0.5; |
| | | } |
| | | //公斤 |
| | | if (specsValue1 == 2) { |
| | | v = amount; |
| | | } |
| | | //吨 |
| | | if (specsValue1 == 3) { |
| | | v = amount * 1000; |
| | | } |
| | | //毫升 |
| | | if (specsValue1 == 4) { |
| | | //毫升换成升 |
| | | double s = amount * 0.001; |
| | | //升换成公斤 |
| | | v = s; |
| | | } |
| | | //升 |
| | | if (specsValue1 == 5) { |
| | | v = amount; |
| | | } |
| | | stockrecord.setCensus(v); |
| | | stockrecordService.save(stockrecord); |
| | | return R.status(save); |
| | | } |
| | |
| | | return R.status(stockService.deleteLogic(Func.toLongList(ids))); |
| | | } |
| | | |
| | | /** |
| | | * 数据统计 |
| | | * |
| | | * @param stock |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/pagenum") |
| | | public R<IPage<StocksVO>> pagenum(StocksVO stock, Query query) { |
| | | IPage<StocksVO> pages = stockService.slectNum(Condition.getPage(query), stock); |
| | | for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | Double cgnum = pages.getRecords().get(i).getCgnum(); |
| | | Double dbrknum = pages.getRecords().get(i).getDbrknum(); |
| | | double v = cgnum + dbrknum; |
| | | pages.getRecords().get(i).setRknum(v); |
| | | Double lycknum = pages.getRecords().get(i).getLycknum(); |
| | | Double dbcknum = pages.getRecords().get(i).getDbcknum(); |
| | | Double bfcknum = pages.getRecords().get(i).getBfcknum(); |
| | | double v1 = lycknum + dbcknum + bfcknum; |
| | | pages.getRecords().get(i).setCknum(v1); |
| | | } |
| | | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import org.springblade.modules.stock.vo.StockVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.stock.vo.StocksVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 农资库存表 Mapper 接口 |
| | |
| | | List<StockVO> selectLists(IPage page, StockVO stock); |
| | | int UpdaeAmountc(@Param("stock") Stock stock); |
| | | int Updaet(@Param("stock") Stock stock); |
| | | List<StocksVO>slectNum(IPage page, StocksVO stock); |
| | | } |
| | |
| | | </select> |
| | | <!--入库出库--> |
| | | <update id="UpdaeAmountc"> |
| | | update sys_stock set amount = #{stock.amount} ,state=#{stock.state} where id=#{stock.id} |
| | | update sys_stock |
| | | set amount = #{stock.amount}, |
| | | state=#{stock.state} |
| | | where id = #{stock.id} |
| | | </update> |
| | | |
| | | <!--入库出库--> |
| | | <update id="Updaet"> |
| | | update sys_stock set amount = #{stock.amount} where id=#{stock.id} |
| | | update sys_stock |
| | | set amount = #{stock.amount} |
| | | where id = #{stock.id} |
| | | </update> |
| | | |
| | | <select id="slectNum" resultType="org.springblade.modules.stock.vo.StocksVO"> |
| | | SELECT id, |
| | | a.agricultural_name as agrname, |
| | | a.factory_name as facname, |
| | | IFNULL(cg.cgnum, 0) AS cgnum, |
| | | IFNULL(dbr.dbrknum, 0) AS dbrknum, |
| | | IFNULL(lyc.lycknum, 0) AS lycknum, |
| | | IFNULL(dbc.dbcknum, 0) AS dbcknum, |
| | | IFNULL(bfc.bfcknum, 0) AS bfcknum |
| | | FROM ( |
| | | SELECT stf.id, |
| | | stf.agricultural_name, |
| | | stf.factory_name |
| | | FROM sys_stockrecord st |
| | | LEFT JOIN (SELECT id, agricultural_name, factory_name FROM sys_stockfactory) stf |
| | | ON st.stock_id1 = stf.id |
| | | GROUP BY stf.id, |
| | | stf.agricultural_name, |
| | | stf.factory_name |
| | | ) a |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS cgnum |
| | | FROM sys_stockrecord |
| | | WHERE stock_type1 = 1 |
| | | AND type1 = 0 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | </if> |
| | | GROUP BY stock_id1) cg ON cg.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS dbrknum |
| | | FROM sys_stockrecord |
| | | WHERE stock_type1 = 1 |
| | | AND type1 = 1 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | </if> |
| | | GROUP BY stock_id1) dbr ON dbr.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS lycknum |
| | | FROM sys_stockrecord |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 0 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | </if> |
| | | GROUP BY stock_id1) lyc ON lyc.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS dbcknum |
| | | FROM sys_stockrecord |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 1 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | </if> |
| | | GROUP BY stock_id1) dbc ON dbc.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS bfcknum |
| | | FROM sys_stockrecord |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 2 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | </if> |
| | | GROUP BY stock_id1) bfc ON bfc.stock_id1 = a.id |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import org.springblade.modules.stock.vo.StockVO; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.stock.vo.StocksVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 农资库存表 服务类 |
| | |
| | | IPage<StockVO> selectLists(IPage<StockVO> page, StockVO stock); |
| | | boolean UpdaeAmountc(Stock stock); |
| | | boolean Updaet(Stock stock); |
| | | IPage<StocksVO> slectNum(IPage<StocksVO> page, StocksVO stock); |
| | | } |
| | |
| | | import org.springblade.modules.stock.mapper.StockMapper; |
| | | import org.springblade.modules.stock.service.IStockService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.modules.stock.vo.StocksVO; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<StocksVO> slectNum(IPage<StocksVO> page, StocksVO stock) { |
| | | return page.setRecords(baseMapper.slectNum(page,stock)); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.stock.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.stock.entity.Stock; |
| | | |
| | | /** |
| | | * 农资库存表视图实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2022-05-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class StocksVO extends Stock { |
| | | private static final long serialVersionUID = 1L; |
| | | String agrname; |
| | | String facname; |
| | | Double cgnum; |
| | | Double dbrknum; |
| | | Double lycknum; |
| | | Double dbcknum; |
| | | Double bfcknum; |
| | | Double rknum; |
| | | Double cknum; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private String startTime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private String endTime; |
| | | |
| | | } |
| | |
| | | Stock stock = new Stock(); |
| | | stock.setId(stockrecord.getSid()); |
| | | stock.setAmount(i); |
| | | //统计公斤 |
| | | Integer specsValue1 = stockrecord.getSpecsVal1(); |
| | | double v = 0; |
| | | //克 |
| | | if (specsValue1 == 0) { |
| | | v = amount1 * 0.001; |
| | | } |
| | | //斤 |
| | | if (specsValue1 == 1) { |
| | | v = amount1 * 0.5; |
| | | } |
| | | //公斤 |
| | | if (specsValue1 == 2) { |
| | | v = amount1; |
| | | } |
| | | //吨 |
| | | if (specsValue1 == 3) { |
| | | v = amount1 * 1000; |
| | | } |
| | | //毫升 |
| | | if (specsValue1 == 4) { |
| | | //毫升换成升 |
| | | double s = amount1 * 0.001; |
| | | //升换成公斤 |
| | | v = s; |
| | | } |
| | | //升 |
| | | if (specsValue1 == 5) { |
| | | v = amount1; |
| | | } |
| | | stockrecord.setCensus(v); |
| | | if (i == 0) { |
| | | stock.setState("1"); |
| | | stockService.UpdaeAmountc(stock); |
| | |
| | | stock.setAmount(i); |
| | | stock.setState("0"); |
| | | stockService.UpdaeAmountc(stock); |
| | | //统计公斤 |
| | | Integer specsValue1 = stockrecord.getSpecsVal1(); |
| | | double v = 0; |
| | | //克 |
| | | if (specsValue1 == 0) { |
| | | v = amount1 * 0.001; |
| | | } |
| | | //斤 |
| | | if (specsValue1 == 1) { |
| | | v = amount1 * 0.5; |
| | | } |
| | | //公斤 |
| | | if (specsValue1 == 2) { |
| | | v = amount1; |
| | | } |
| | | //吨 |
| | | if (specsValue1 == 3) { |
| | | v = amount1 * 1000; |
| | | } |
| | | //毫升 |
| | | if (specsValue1 == 4) { |
| | | //毫升换成升 |
| | | double s = amount1 * 0.001; |
| | | //升换成公斤 |
| | | v = s; |
| | | } |
| | | //升 |
| | | if (specsValue1 == 5) { |
| | | v = amount1; |
| | | } |
| | | stockrecord.setCensus(v); |
| | | } |
| | | return R.status(stockrecordService.save(stockrecord)); |
| | | } |
| | |
| | | private String sp1; |
| | | private String sp2; |
| | | private Long sid; |
| | | private Double census; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 出入库记录 Mapper 接口 |
| | |
| | | */ |
| | | List<StockrecordVO> selectStockrecordPage(IPage page, StockrecordVO stockrecord); |
| | | List<StockrecordVO> seletStockRecordList(IPage page, StockrecordVO stockrecord); |
| | | |
| | | } |
| | |
| | | <if test="stockrecord.stype!=null and stockrecord.stype != ''"> |
| | | and stf.type = #{stockrecord.stype} |
| | | </if> |
| | | <if test="stockrecord.stockId1!=null and stockrecord.stockId1 != ''"> |
| | | and st.stock_id1 = #{stockrecord.stockId1} |
| | | <if test="stockrecord.sid!=null and stockrecord.sid != ''"> |
| | | and st.sid = #{stockrecord.sid} |
| | | </if> |
| | | </select> |
| | | </mapper> |