升级代码结构,采用Maven来管理jar包(10)

This commit is contained in:
季圣华
2017-02-15 22:55:46 +08:00
parent 11f18afad6
commit e85498f6f4
185 changed files with 19714 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
package com.jsh.service.materials;
import com.jsh.base.BaseIService;
import com.jsh.util.JshException;
import com.jsh.model.po.AccountHead;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.PageUtil;
public interface AccountHeadIService extends BaseIService<AccountHead>
{
/*
* 获取MaxId
*/
void find(PageUtil<AccountHead> accountHead,String maxid)throws JshException;
}

View File

@@ -0,0 +1,32 @@
package com.jsh.service.materials;
import com.jsh.base.BaseService;
import com.jsh.dao.materials.AccountHeadIDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.AccountHead;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.PageUtil;
public class AccountHeadService extends BaseService<AccountHead> implements AccountHeadIService
{
@SuppressWarnings("unused")
private AccountHeadIDAO accountHeadDao;
public void setAccountHeadDao(AccountHeadIDAO accountHeadDao) {
this.accountHeadDao = accountHeadDao;
}
@Override
protected Class<AccountHead> getEntityClass()
{
return AccountHead.class;
}
@Override
public void find(PageUtil<AccountHead> pageUtil, String maxid) throws JshException
{
accountHeadDao.find(pageUtil, maxid);
}
}

View File

@@ -0,0 +1,18 @@
package com.jsh.service.materials;
import java.io.InputStream;
import java.util.List;
import net.sf.json.JSONArray;
import com.jsh.base.BaseIService;
import com.jsh.util.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.po.AccountHead;
import com.jsh.model.po.AccountItem;
import com.jsh.util.PageUtil;
public interface AccountItemIService extends BaseIService<AccountItem>
{
}

View File

@@ -0,0 +1,38 @@
package com.jsh.service.materials;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import com.jsh.base.BaseService;
import com.jsh.base.Log;
import com.jsh.util.AssetConstants;
import com.jsh.dao.materials.AccountItemIDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.po.AccountHead;
import com.jsh.model.po.AccountItem;
import com.jsh.util.PageUtil;
import com.jsh.util.Tools;
public class AccountItemService extends BaseService<AccountItem> implements AccountItemIService
{
@SuppressWarnings("unused")
private AccountItemIDAO accoumtItemDao;
public void setAccountItemDao(AccountItemIDAO accoumtItemDao) {
this.accoumtItemDao = accoumtItemDao;
}
@Override
protected Class<AccountItem> getEntityClass()
{
return AccountItem.class;
}
}

View File

@@ -0,0 +1,15 @@
package com.jsh.service.materials;
import com.jsh.base.BaseIService;
import com.jsh.util.JshException;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.PageUtil;
public interface DepotHeadIService extends BaseIService<DepotHead>
{
/*
* 获取MaxId
*/
void find(PageUtil<DepotHead> depotHead,String maxid)throws JshException;
}

View File

@@ -0,0 +1,32 @@
package com.jsh.service.materials;
import com.jsh.base.BaseService;
import com.jsh.dao.materials.DepotHeadIDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.UserBusiness;
import com.jsh.util.PageUtil;
public class DepotHeadService extends BaseService<DepotHead> implements DepotHeadIService
{
@SuppressWarnings("unused")
private DepotHeadIDAO depotHeadDao;
public void setDepotHeadDao(DepotHeadIDAO depotHeadDao) {
this.depotHeadDao = depotHeadDao;
}
@Override
protected Class<DepotHead> getEntityClass()
{
return DepotHead.class;
}
@Override
public void find(PageUtil<DepotHead> pageUtil, String maxid) throws JshException
{
depotHeadDao.find(pageUtil, maxid);
}
}

View File

@@ -0,0 +1,26 @@
package com.jsh.service.materials;
import java.io.InputStream;
import java.util.List;
import net.sf.json.JSONArray;
import com.jsh.base.BaseIService;
import com.jsh.util.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.DepotItem;
import com.jsh.util.PageUtil;
public interface DepotItemIService extends BaseIService<DepotItem>
{
void findByType(PageUtil<DepotItem> depotItem, String type, Long MId, String MonthTime,Boolean isPrev)throws JshException;
void buyOrSale(PageUtil<DepotItem> depotItem, String type, String subType, Long MId, String MonthTime, String sumType)throws JshException;
/**
* 导出信息
* @return
*/
InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws JshException;
}

View File

@@ -0,0 +1,124 @@
package com.jsh.service.materials;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import com.jsh.base.BaseService;
import com.jsh.base.Log;
import com.jsh.util.AssetConstants;
import com.jsh.dao.materials.DepotItemIDAO;
import com.jsh.util.JshException;
import com.jsh.model.po.Asset;
import com.jsh.model.po.DepotHead;
import com.jsh.model.po.DepotItem;
import com.jsh.util.PageUtil;
import com.jsh.util.Tools;
public class DepotItemService extends BaseService<DepotItem> implements DepotItemIService
{
@SuppressWarnings("unused")
private DepotItemIDAO depotItemDao;
public void setDepotItemDao(DepotItemIDAO depotItemDao) {
this.depotItemDao = depotItemDao;
}
@Override
protected Class<DepotItem> getEntityClass()
{
return DepotItem.class;
}
@Override
public void findByType(PageUtil<DepotItem> pageUtil, String type,Long MId, String MonthTime,Boolean isPrev) throws JshException
{
depotItemDao.findByType(pageUtil, type, MId, MonthTime,isPrev);
}
@Override
public void buyOrSale(PageUtil<DepotItem> pageUtil, String type,String subType, Long MId, String MonthTime, String sumType) throws JshException
{
depotItemDao.buyOrSale(pageUtil, type, subType, MId, MonthTime, sumType);
}
/**
* 导出Excel表格
*/
@Override
public InputStream exmportExcel(String isAllPage,JSONArray dataArray)throws JshException
{
try
{
//将OutputStream转化为InputStream
ByteArrayOutputStream out = new ByteArrayOutputStream();
putDataOnOutputStream(out,dataArray);
return new ByteArrayInputStream(out.toByteArray());
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出信息为excel表格异常", e);
throw new JshException("export asset info to excel exception",e);
}
}
/**
* 生成excel表格
* @param os
*/
@SuppressWarnings("deprecation")
private void putDataOnOutputStream(OutputStream os,JSONArray dataArray)
{
WritableWorkbook workbook = null;
try
{
workbook = Workbook.createWorkbook(os);
WritableSheet sheet = workbook.createSheet("进销存报表", 0);
//增加列头
int[] colunmWidth = {10,10,10,10,15,15,15,15,15};
String[] colunmName = {"名称","款号","颜色","单价","上月结存数量","入库数量","出库数量","本月结存数量","结存金额"};
for(int i = 0 ;i < colunmWidth.length;i ++)
{
sheet.setColumnView(i,colunmWidth[i]);
sheet.addCell(new Label(i, 0, colunmName[i]));
}
if (null != dataArray &&dataArray.size() > 0)
{
for(int j=0; j < dataArray.size(); j++){
JSONObject jo = JSONObject.fromObject(dataArray.get(j));
sheet.addCell(new Label(0, j+1, jo.getString("MaterialName")));
sheet.addCell(new Label(1, j+1, jo.getString("MaterialModel")));
sheet.addCell(new Label(2, j+1, jo.getString("MaterialColor")));
sheet.addCell(new Label(3, j+1, jo.getString("UnitPrice")));
sheet.addCell(new Label(4, j+1, jo.getString("prevSum")));
sheet.addCell(new Label(5, j+1, jo.getString("InSum")));
sheet.addCell(new Label(6, j+1, jo.getString("OutSum")));
sheet.addCell(new Label(7, j+1, jo.getString("thisSum")));
double d = Double.parseDouble(jo.getString("thisAllPrice").toString());
String s1 = String.format("%.2f", d);
sheet.addCell(new Label(8, j+1, s1));
}
}
workbook.write();
workbook.close();
}
catch (Exception e)
{
Log.errorFileSync(">>>>>>>>>>>>>>>>>>>>>>>导出资产信息为excel表格异常", e);
}
}
}

View File

@@ -0,0 +1,9 @@
package com.jsh.service.materials;
import com.jsh.base.BaseIService;
import com.jsh.model.po.MaterialCategory;
public interface MaterialCategoryIService extends BaseIService<MaterialCategory>
{
}

View File

@@ -0,0 +1,24 @@
package com.jsh.service.materials;
import com.jsh.base.BaseService;
import com.jsh.dao.materials.MaterialCategoryIDAO;
import com.jsh.model.po.MaterialCategory;
public class MaterialCategoryService extends BaseService<MaterialCategory> implements MaterialCategoryIService
{
@SuppressWarnings("unused")
private MaterialCategoryIDAO materialCategoryDao;
public void setMaterialCategoryDao(MaterialCategoryIDAO materialCategoryDao) {
this.materialCategoryDao = materialCategoryDao;
}
@Override
protected Class<MaterialCategory> getEntityClass()
{
return MaterialCategory.class;
}
}

View File

@@ -0,0 +1,9 @@
package com.jsh.service.materials;
import com.jsh.base.BaseIService;
import com.jsh.model.po.Material;
public interface MaterialIService extends BaseIService<Material>
{
}

View File

@@ -0,0 +1,24 @@
package com.jsh.service.materials;
import com.jsh.base.BaseService;
import com.jsh.dao.materials.MaterialIDAO;
import com.jsh.model.po.Material;
public class MaterialService extends BaseService<Material> implements MaterialIService
{
@SuppressWarnings("unused")
private MaterialIDAO materialDao;
public void setMaterialDao(MaterialIDAO materialDao) {
this.materialDao = materialDao;
}
@Override
protected Class<Material> getEntityClass()
{
return Material.class;
}
}

View File

@@ -0,0 +1,9 @@
package com.jsh.service.materials;
import com.jsh.base.BaseIService;
import com.jsh.model.po.Person;
public interface PersonIService extends BaseIService<Person>
{
}

View File

@@ -0,0 +1,24 @@
package com.jsh.service.materials;
import com.jsh.base.BaseService;
import com.jsh.dao.materials.PersonIDAO;
import com.jsh.model.po.Person;
public class PersonService extends BaseService<Person> implements PersonIService
{
@SuppressWarnings("unused")
private PersonIDAO personDao;
public void setPersonDao(PersonIDAO personDao) {
this.personDao = personDao;
}
@Override
protected Class<Person> getEntityClass()
{
return Person.class;
}
}