Commit 96ef72a7 authored by suichenguang's avatar suichenguang

添加物料出入库统计

parent f3583d35
......@@ -118,7 +118,6 @@ public class LogApi {
logService.changeFileState(fileId);
//查询身份数据
List<Map<String, Object>> dataList = logService.selectIdData(fileId);
System.out.println("0000000000000000000000000000000000"+dataList);
//将身份数据插入到邮寄表中
for (int i=0;i<dataList.size();i++){
logService.insertIdData((String) dataList.get(i).get("GMSFHM"),(String) dataList.get(i).get("SSXQDM"),(String) dataList.get(i).get("YXQQSRQ"),(String) dataList.get(i).get("YXQJZRQ"), (String) dataList.get(i).get("JMSFZSLH"));
......
package com.yxproject.start.api;
import com.yxproject.start.entity.CardBodyEntity;
import com.yxproject.start.entity.PlasticFilmEntity;
import com.yxproject.start.service.MaterialManagementService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("MaterialManagementApi")
public class MaterialManagementApi {
@Autowired
private MaterialManagementService materialManagementService;
/**
* 插入膜耗材数据
* @param totalCount
* @param plasticFilmType
* @param note
* @return
*/
@RequestMapping("insertFilm")
public boolean insertFilm(@Param("totalCount")String totalCount, @Param("plasticFilmType")String plasticFilmType, @Param("note")String note){
boolean result = materialManagementService.insertFilm(totalCount, plasticFilmType, note);
return result;
}
/**
* 插入卡体耗材数据
* @param cardType
* @param totalCount
* @param note
* @return
*/
@RequestMapping("insertCardBody")
public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note){
boolean result = materialManagementService.insertCardBody(cardType, totalCount, note);
return result;
}
/**
* 查询耗材统计数据
* @param beginDate
* @param endDate
* @return
*/
@RequestMapping("selectMaterialManagement")
public Map<String,Object> selectMaterialManagement(@Param("beginDate")String beginDate,@Param("endDate")String endDate){
Map<String,Object> resultMap = new HashMap<>();
List<CardBodyEntity> cardBodyEntities = materialManagementService.selectCardBody(replaceDate(beginDate),replaceDate(endDate));
List<PlasticFilmEntity> plasticFilmEntities = materialManagementService.selectFilm(replaceDate(beginDate),replaceDate(endDate));
String cardCount1 = materialManagementService.selectCardCount1(beginDate,endDate);
String cardCount2 = materialManagementService.selectCardCount2(beginDate,endDate);
String plasticFilmCount1=materialManagementService.selectFilmCount1(beginDate,endDate);
String plasticFilmCount2=materialManagementService.selectFilmCount2(beginDate,endDate);
resultMap.put("cardBody",cardBodyEntities);
resultMap.put("cardCount1",cardCount1);
resultMap.put("cardCount2",cardCount2);
resultMap.put("plasticFilm",plasticFilmEntities);
resultMap.put("plasticFilmCount1",plasticFilmCount1);
resultMap.put("plasticFilmCount2",plasticFilmCount2);
return resultMap;
}
/**
* 去除字符串中中线
* @param str
* @return
*/
private String replaceDate(String str){
return str.replace("-","").replace(" ","");
}
}
......@@ -176,7 +176,7 @@ public interface LogMapper {
public List<Map<String,Object>> selectIdData(@Param("fileId")String fileId);
//身份数据插入person_post
@Update("UPDATE PERSON_POST SET ID_CARD=#{cardId},ACCEPT_THE_MATTER=#{issuing},BEGIN_USEFUL_LIFE=#{beginDate},VALID_PERIOD_END=#{endDate} where PERSON_POST.FIRST_WHITE=#{firstWhite}")
@Update("UPDATE PERSON_POST SET ID_CARD=#{cardId},ACCEPT_THE_MATTER=#{issuing},BEGIN_USEFUL_LIFE=#{beginDate},VALID_PERIOD_END=#{endDate} where PERSON_POST.FIRST_WHITE=#{firstWhite}")
public boolean insertIdData(@Param("cardId")String cardId,@Param("issuing") String issuing,@Param("beginDate")String beginDate,@Param("endDate")String endDate,@Param("firstWhite")String firstWhite );
......
package com.yxproject.start.mapper;
import com.yxproject.start.entity.CardBodyEntity;
import com.yxproject.start.entity.PlasticFilmEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Mapper
public interface MaterialManagementMapper {
@Insert("INSERT INTO PLASTIC_FILM (TOTAL_COUNT,PLASTIC_FILM_TYPE,NOTE)VALUES(#{totalCount},#{plasticFilmType},#{note})")
public boolean insertFilm(@Param("totalCount")String totalCount,@Param("plasticFilmType")String plasticFilmType,@Param("note")String note);
@Select("select * from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate}")
public List<PlasticFilmEntity> selectFilm(@Param("beginDate") String beginDate,@Param("endDate")String endDate);
@Select("select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and PLASTIC_FILM_TYPE=1 ")
public String selectFilmCount1(@Param("beginDate") String beginDate,@Param("endDate")String endDate);
@Select("select sum(TOTAL_COUNT) PLASTIC_FILM_TYPE1 from plastic_film where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and PLASTIC_FILM_TYPE=2")
public String selectFilmCount2(@Param("beginDate") String beginDate,@Param("endDate")String endDate);
@Insert("INSERT INTO CARD_BODY (CARD_TYPE,TOTAL_COUNT,NOTE)VALUES(#{cardType},#{totalCount},#{note})")
public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note);
@Select("select * from CARD_BODY where to_char(SAVE_DATE,'yyyyMMdd') between #{beginDate} and #{endDate}")
public List<CardBodyEntity> selectCardBody(@Param("beginDate")String beginDate,@Param("endDate")String endDate);
@Select("select sum(TOTAL_COUNT) cardType1 from CARD_BODY where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and CARD_TYPE=1")
public String selectCardCount1(@Param("beginDate")String beginDate,@Param("endDate")String endDate);
@Select("select sum(TOTAL_COUNT) cardType2 from CARD_BODY where to_char(save_date,'yyyyMMdd') BETWEEN #{beginDate} and #{endDate} and CARD_TYPE=2")
public String selectCardCount2(@Param("beginDate")String beginDate,@Param("endDate")String endDate);
}
package com.yxproject.start.service;
import com.yxproject.start.entity.CardBodyEntity;
import com.yxproject.start.entity.PlasticFilmEntity;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface MaterialManagementService {
public boolean insertFilm( @Param("totalCount")String totalCount, @Param("plasticFilmType")String plasticFilmType, @Param("note")String note);
public List<PlasticFilmEntity> selectFilm(@Param("beginDate") String beginDate, @Param("endDate")String endDate);
public boolean insertCardBody(@Param("cardType")String cardType,@Param("totalCount")String totalCount,@Param("note")String note);
public List<CardBodyEntity> selectCardBody(@Param("beginDate")String beginDate, @Param("endDate")String endDate);
public String selectFilmCount1(@Param("beginDate") String beginDate,@Param("endDate")String endDate);
public String selectFilmCount2(@Param("beginDate") String beginDate,@Param("endDate")String endDate);
public String selectCardCount1(@Param("beginDate")String beginDate,@Param("endDate")String endDate);
public String selectCardCount2(@Param("beginDate")String beginDate,@Param("endDate")String endDate);
}
package com.yxproject.start.service.impl;
import com.yxproject.start.entity.CardBodyEntity;
import com.yxproject.start.entity.PlasticFilmEntity;
import com.yxproject.start.mapper.MaterialManagementMapper;
import com.yxproject.start.service.MaterialManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class MaterialManagementServiceImpl implements MaterialManagementService {
@Autowired
private MaterialManagementMapper materialManagementMapper;
@Override
public boolean insertFilm( String totalCount, String plasticFilmType, String note) {
materialManagementMapper.insertFilm(totalCount,plasticFilmType,note);
return true;
}
@Override
public List<PlasticFilmEntity> selectFilm(String beginDate, String endDate) {
List<PlasticFilmEntity> resultList = materialManagementMapper.selectFilm(beginDate, endDate);
return resultList;
}
@Override
public boolean insertCardBody( String cardType, String totalCount, String note) {
materialManagementMapper.insertCardBody(cardType,totalCount,note);
return true;
}
@Override
public List<CardBodyEntity> selectCardBody(String beginDate, String endDate) {
List<CardBodyEntity> resultList = materialManagementMapper.selectCardBody(beginDate, endDate);
return resultList;
}
@Override
public String selectFilmCount1(String beginDate, String endDate) {
String result = materialManagementMapper.selectFilmCount1(beginDate, endDate);
return result;
}
@Override
public String selectFilmCount2(String beginDate, String endDate) {
String result = materialManagementMapper.selectFilmCount2(beginDate, endDate);
return result;
}
@Override
public String selectCardCount1(String beginDate, String endDate) {
String result = materialManagementMapper.selectCardCount1(beginDate, endDate);
return result;
}
@Override
public String selectCardCount2(String beginDate, String endDate) {
String result = materialManagementMapper.selectCardCount2(beginDate, endDate);
return result;
}
}
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