基于javaweb+mysql的springboot办公erp管理系统(java+springboot+easyui+maven+mysql+html)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot办公erp管理系统(java+springboot+easyui+maven+mysql+html)
项目介绍
系统主要功能包括: 首页 零售管理:零售出库、零售退货; 采购管理:采购订单、采购入库、采购退货; 销售管理:销售订单、销售出库、销售退货; 仓库管理:其它入库、其它出库、调拨出库、组装单、拆卸单; 财务管理:收入单、支出单、收款单、付款单、转账单、收预付款; 报表查询:库存状况、结算账户、进货统计、销售统计、入库明细、出库明细、入库汇总、出库汇总、客户对账、供应商对账、库存预警; 商品管理:商品类别、商品信息、计量单位、序列号; 基本资料:供应商信息、客户信息、会员信息、仓库信息、收支项目、结算账户、经手人管理;
系统管理:角色管理、机构管理、用户管理、日志管理、系统配置;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7或8.0版本;
6.是否Maven项目:是;
技术栈
-
核心框架:SpringBoot 2.0.0 * 持久层框架:Mybatis 1.3.2 * 日志管理:Log4j 2.10.0 * JS框架:Jquery 1.8.0 * UI框架: EasyUI 1.3.5 * 模板框架: AdminLTE 2.4.0
-
项目管理框架: Maven 3.2.3
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.properties配置文件中的数据库配置改为自己的配置; 4. 运行com.jsh.erp包中的ErpApplication类,启动项目。(使用SpringBoot的启动方式) 5. 浏览器地址访问登录页面http://localhost:8080/login.html 默认管理员账号:admin,管理员账号一些特殊模块不具有修改权限,建议使用普通账号:jsh,密码都为123456
public int checkIsNameExist(Long id, String name)throws Exception {
DepotItemExample example = new DepotItemExample();
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<DepotItem> list =null;
try{
list=depotItemMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
public List<DepotItemVo4DetailByTypeAndMId> findDetailByTypeAndMaterialIdList(Map<String, String> map)throws Exception {
String mIdStr = map.get("mId");
Long mId = null;
if(!StringUtil.isEmpty(mIdStr)) {
mId = Long.parseLong(mIdStr);
}
List<DepotItemVo4DetailByTypeAndMId> list =null;
try{
list = depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public Long findDetailByTypeAndMaterialIdCounts(Map<String, String> map)throws Exception {
String mIdStr = map.get("mId");
Long mId = null;
if(!StringUtil.isEmpty(mIdStr)) {
mId = Long.parseLong(mIdStr);
}
Long result =null;
try{
result = depotItemMapperEx.findDetailByTypeAndMaterialIdCounts(mId);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertDepotItemWithObj(DepotItem depotItem)throws Exception {
int result =0;
try{
result = depotItemMapper.insertSelective(depotItem);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
int result=0;
try{
result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber);
logService.insertLog("序列号",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteSerialNumber(Long id, HttpServletRequest request)throws Exception {
int result=0;
try{
result=serialNumberMapper.deleteByPrimaryKey(id);
logService.insertLog("序列号",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSerialNumber(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
SerialNumberExample example = new SerialNumberExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result=serialNumberMapper.deleteByExample(example);
logService.insertLog("序列号", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public int checkIsNameExist(Long id, String serialNumber)throws Exception {
SerialNumberExample example = new SerialNumberExample();
example.createCriteria().andIdNotEqualTo(id).andSerialNumberEqualTo(serialNumber).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<SerialNumber> list=null;
try{
list=serialNumberMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
}
}
objectMap.put("page", queryInfo);
if (list == null) {
queryInfo.setRows(new ArrayList<Object>());
queryInfo.setTotal(BusinessConstants.DEFAULT_LIST_NULL_NUMBER);
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
}
queryInfo.setRows(dataArray);
queryInfo.setTotal(depotItemService.findDetailByTypeAndMaterialIdCounts(parameterMap));
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 根据商品id和仓库id查询库存数量
* @param depotId
* @param mId
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/findStockNumById")
public BaseResponseInfo findStockNumById(
@RequestParam("depotId") Long depotId,
@RequestParam("mId") Long mId,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
map.put("stock", depotItemService.getStockByParam(depotId,mId,null,null,tenantId));
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 查询计量单位信息
*
* @return
*/
public String findUnitName(Long mId)throws Exception {
String unitName = "";
try {
unitName = materialService.findUnitName(mId);
if (unitName != null) {
unitName = unitName.substring(1, unitName.length() - 1);
if (unitName.equals("null")) {
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
int result=0;
try{
result = accountItemMapper.insertSelective(accountItem);
logService.insertLog("财务明细", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAccountItem(String beanJson, Long id, HttpServletRequest request)throws Exception {
AccountItem accountItem = JSONObject.parseObject(beanJson, AccountItem.class);
accountItem.setId(id);
int result=0;
try{
result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
logService.insertLog("财务明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteAccountItem(Long id, HttpServletRequest request)throws Exception {
int result=0;
try{
result = accountItemMapper.deleteByPrimaryKey(id);
logService.insertLog("财务明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteAccountItem(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
AccountItemExample example = new AccountItemExample();
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertSerialNumber(String beanJson, HttpServletRequest request)throws Exception {
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
logService.insertLog("序列号", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
int result=0;
try{
result=serialNumberMapper.insertSelective(serialNumber);
logService.insertLog("序列号", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateSerialNumber(String beanJson, Long id, HttpServletRequest request) throws Exception{
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
serialNumber.setId(id);
int result=0;
try{
result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber);
logService.insertLog("序列号",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteSerialNumber(Long id, HttpServletRequest request)throws Exception {
int result=0;
try{
result=serialNumberMapper.deleteByPrimaryKey(id);
logService.insertLog("序列号",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSerialNumber(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
SerialNumberExample example = new SerialNumberExample();
example.createCriteria().andIdIn(idList);
int result=0;
}
public Long countAccount(String name, String serialNo, String remark)throws Exception {
Long result=null;
try{
result=accountMapperEx.countsByAccount(name, serialNo, remark);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertAccount(String beanJson, HttpServletRequest request)throws Exception {
Account account = JSONObject.parseObject(beanJson, Account.class);
if(account.getInitialamount() == null) {
account.setInitialamount(BigDecimal.ZERO);
}
account.setIsdefault(false);
int result=0;
try{
result = accountMapper.insertSelective(account);
logService.insertLog("账户", BusinessConstants.LOG_OPERATION_TYPE_ADD, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAccount(String beanJson, Long id, HttpServletRequest request)throws Exception {
Account account = JSONObject.parseObject(beanJson, Account.class);
account.setId(id);
int result=0;
try{
result = accountMapper.updateByPrimaryKeySelective(account);
logService.insertLog("账户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteAccount(Long id, HttpServletRequest request) throws Exception{
int result=0;
try{
result = accountMapper.deleteByPrimaryKey(id);
logService.insertLog("账户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
if(depotHead.getOrganid()!=null){
supplierService.updateAdvanceIn(depotHead.getOrganid(), BigDecimal.ZERO.subtract(depotHead.getTotalprice().subtract(preTotalPrice)));
}
}
/**入库和出库处理单据子表信息*/
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId,request);
}
/**
* create by: cjl
* description:
* 删除单据主表及子表信息
* @Param: id
* @return java.lang.Object
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void deleteDepotHeadAndDetail(Long id) throws Exception {
logService.insertLog("单据",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//查询单据主表信息
DepotHead depotHead =getDepotHead(id);
User userInfo=userService.getCurrentUser();
//删除出库数据回收序列号
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
//查询单据子表列表
List<DepotItem> depotItemList=null;
try{
depotItemList = depotItemMapperEx.findDepotItemListBydepotheadId(id,BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED);
}catch(Exception e){
JshException.readFail(logger, e);
}
/**回收序列号*/
if(depotItemList!=null&&depotItemList.size()>0){
for(DepotItem depotItem:depotItemList){
//BasicNumber=OperNumber*ratio
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
}
}
}
/**删除单据子表数据*/
try{
depotItemMapperEx.batchDeleteDepotItemByDepotHeadIds(new Long []{id});
}catch(Exception e){
JshException.writeFail(logger, e);
}
if (index != -1) {
return ip.substring(0, index);
} else {
return ip;
}
} else {
return request.getRemoteAddr();
}
}
/**
* 转化前台批量传入的ID值
*
* @param data
* @return 转化后的ID值数组
*/
public static int[] changeDataForm(String data) {
String[] dataStr = data.split(",");
int[] dataInt = new int[dataStr.length];
for (int i = 0; i < dataStr.length; i++)
dataInt[i] = Integer.parseInt(dataStr[i]);
return dataInt;
}
/**
* 解决导出文件中文乱码问题firefox和ie下中文乱码
*/
public static String changeUnicode(String fileName, String browserType) {
String returnFileName = "";
try {
if (browserType.equalsIgnoreCase("MSIE")) {
returnFileName = URLEncoder.encode(fileName, "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
if (returnFileName.length() > 150) {
returnFileName = new String(fileName.getBytes("GB2312"), "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
}
} else if (browserType.equalsIgnoreCase("Firefox")) {
returnFileName = new String(fileName.getBytes("ISO8859-1"), "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
} else {
returnFileName = URLEncoder.encode(fileName, "ISO8859-1");
returnFileName = returnFileName.replace(" ", "%20");
if (returnFileName.length() > 150) {
/**
*/
@RestController
@RequestMapping(value = "/functions")
public class FunctionsController {
private Logger logger = LoggerFactory.getLogger(FunctionsController.class);
@Resource
private FunctionsService functionsService;
@Resource
private UserBusinessService userBusinessService;
@PostMapping(value = "/findMenu")
public JSONArray findMenu(@RequestParam(value="pNumber") String pNumber,
@RequestParam(value="hasFunctions") String hasFunctions,
HttpServletRequest request)throws Exception {
//存放数据json数组
JSONArray dataArray = new JSONArray();
try {
String fc = hasFunctions; //当前用户所拥有的功能列表,格式如:[1][2][5]
List<Functions> dataList = functionsService.getRoleFunctions(pNumber);
if (null != dataList) {
for (Functions functions : dataList) {
JSONObject item = new JSONObject();
item.put("id", functions.getId());
List<Functions> dataList1 = functionsService.getRoleFunctions(functions.getNumber());
JSONArray dataArray1 = new JSONArray();
if (dataList1.size() != 0) {
item.put("text", functions.getName()); //是目录就没链接
item.put("icon", functions.getIcon());
for (Functions functions1 : dataList1) {
item.put("state", "open"); //如果不为空,节点展开
JSONObject item1 = new JSONObject();
List<Functions> dataList2 = functionsService.getRoleFunctions(functions1.getNumber());
if (fc.indexOf("[" + functions1.getId().toString() + "]") != -1 || dataList2.size() != 0) {
item1.put("id", functions1.getId());
JSONArray dataArray2 = new JSONArray();
if (dataList2.size() != 0) {
item1.put("text", functions1.getName());//是目录就没链接
item1.put("icon", functions1.getIcon());
for (Functions functions2 : dataList2) {
item1.put("state", "closed"); //如果不为空,节点不展开
JSONObject item2 = new JSONObject();
List<Functions> dataList3 = functionsService.getRoleFunctions(functions2.getNumber());
if (fc.indexOf("[" + functions2.getId().toString() + "]") != -1 || dataList3.size() != 0) {
item2.put("id", functions2.getId());
JSONArray dataArray3 = new JSONArray();
try{
result=depotItemMapper.deleteByExample(example);
logService.insertLog("单据明细", "批量删除,id集:" + ids, request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public int checkIsNameExist(Long id, String name)throws Exception {
DepotItemExample example = new DepotItemExample();
example.createCriteria().andIdNotEqualTo(id).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<DepotItem> list =null;
try{
list=depotItemMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
public List<DepotItemVo4DetailByTypeAndMId> findDetailByTypeAndMaterialIdList(Map<String, String> map)throws Exception {
String mIdStr = map.get("mId");
Long mId = null;
if(!StringUtil.isEmpty(mIdStr)) {
mId = Long.parseLong(mIdStr);
}
List<DepotItemVo4DetailByTypeAndMId> list =null;
try{
list = depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public Long findDetailByTypeAndMaterialIdCounts(Map<String, String> map)throws Exception {
String mIdStr = map.get("mId");
Long mId = null;
if(!StringUtil.isEmpty(mIdStr)) {
public static void main(String[] args) {
String aa = "的付的反对法的发的说法";
char[] bb = aa.toCharArray();
for (char c : bb) {
System.out.println(c);
}
System.out.println(getBeforeMonth(1));
try {
System.out.println(md5Encryp("guest"));
System.out.println(md5Encryp("admin"));
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String value = "2333";
System.out.println(checkStrIsNum(value));
for (int i = 0; i < 100; i++) {
System.out.print(getRandomChar() + " || ");
}
}
}
try {
List<DepotItemVo4WithInfoEx> dataList = depotItemService.findByAll(headIds, materialIds, (currentPage-1)*pageSize, pageSize);
//存放数据json数组
String[] names = {"名称", "型号", "单位", "单价", "上月结存数量", "入库数量", "出库数量", "本月结存数量", "结存金额"};
String title = "库存报表";
List<String[]> objects = new ArrayList<String[]>();
if (null != dataList) {
for (DepotItemVo4WithInfoEx diEx : dataList) {
Long mId = diEx.getMId();
String timeA = monthTime+"-01 00:00:00";
String timeB = monthTime+"-31 23:59:59";
String[] objs = new String[9];
objs[0] = diEx.getMName().toString();
objs[1] = diEx.getMModel().toString();
objs[2] = diEx.getMaterialUnit().toString();
objs[3] = getUnitPrice(diEx.getPresetPriceOne(), diEx.getPriceStrategy()).toString();
objs[4] = depotItemService.getStockByParam(depotId,mId,null,timeA,tenantId).toString();
objs[5] = depotItemService.getInNumByParam(depotId,mId,timeA,timeB,tenantId).toString();
objs[6] = depotItemService.getOutNumByParam(depotId,mId,timeA,timeB,tenantId).toString();
BigDecimal thisSum = depotItemService.getStockByParam(depotId,mId,null,null,tenantId);
objs[7] = thisSum.toString();
objs[8] = thisSum.multiply(getUnitPrice(diEx.getPresetPriceOne(), diEx.getPriceStrategy())).toString();
objects.add(objs);
}
}
File file = ExcelUtils.exportObjectsWithoutTitle(title, names, title, objects);
ExportExecUtil.showExec(file, file.getName() + "-" + monthTime, response);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 统计总计金额
* @param pid
* @param monthTime
* @param headIds
* @param materialIds
* @param request
* @return
*/
@PostMapping(value = "/totalCountMoney")
public BaseResponseInfo totalCountMoney(@RequestParam("depotId") Long depotId,
@RequestParam("monthTime") String monthTime,
@RequestParam("headIds") String headIds,
@RequestParam("materialIds") String materialIds,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}
/**
*/
@RestController
@RequestMapping(value = "/supplier")
public class SupplierController {
private Logger logger = LoggerFactory.getLogger(SupplierController.class);
@Resource
private SupplierService supplierService;
@Resource
try{
result = depotItemMapperEx.inOrOutPrice(type, subType, MonthTime);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
/**
* 我之前对操作数量的理解有偏差
* 这里重点重申一下:BasicNumber=OperNumber*ratio
* */
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId, HttpServletRequest request) throws Exception{
logService.insertLog("单据明细",
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//查询单据主表信息
DepotHead depotHead=null;
try{
depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
}catch(Exception e){
JshException.readFail(logger, e);
}
//获得当前操作人
User userInfo=userService.getCurrentUser();
//转为json
JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted);
JSONArray updatedJson = JSONArray.parseArray(updated);
/**
* 删除的可以继续卖,删除的需要将使用的序列号回收
* 插入的需要判断当前货源是否充足
* 更新的需要判断货源是否充足
* */
if (null != deletedJson) {
StringBuffer bf=new StringBuffer();
for (int i = 0; i < deletedJson.size(); i++) {
//首先回收序列号,如果是调拨,不用处理序列号
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
if(depotItem==null){
continue;
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateSerialNumber(String beanJson, Long id, HttpServletRequest request) throws Exception{
SerialNumber serialNumber = JSONObject.parseObject(beanJson, SerialNumber.class);
serialNumber.setId(id);
int result=0;
try{
result=serialNumberMapper.updateByPrimaryKeySelective(serialNumber);
logService.insertLog("序列号",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int deleteSerialNumber(Long id, HttpServletRequest request)throws Exception {
int result=0;
try{
result=serialNumberMapper.deleteByPrimaryKey(id);
logService.insertLog("序列号",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSerialNumber(String ids, HttpServletRequest request)throws Exception {
List<Long> idList = StringUtil.strToLongList(ids);
SerialNumberExample example = new SerialNumberExample();
example.createCriteria().andIdIn(idList);
int result=0;
try{
result=serialNumberMapper.deleteByExample(example);
public Account getAccount(long id) throws Exception{
return accountMapper.selectByPrimaryKey(id);
}
public List<Account> getAccount() throws Exception{
AccountExample example = new AccountExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Account> list=null;
try{
list=accountMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<AccountVo4List> select(String name, String serialNo, String remark, int offset, int rows) throws Exception{
List<AccountVo4List> resList = new ArrayList<AccountVo4List>();
List<AccountVo4List> list=null;
try{
list = accountMapperEx.selectByConditionAccount(name, serialNo, remark, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
String timeStr = Tools.getCurrentMonth();
if (null != list && null !=timeStr) {
for (AccountVo4List al : list) {
DecimalFormat df = new DecimalFormat(".##");
BigDecimal thisMonthAmount = getAccountSum(al.getId(), timeStr, "month").add(getAccountSumByHead(al.getId(), timeStr, "month")).add(getAccountSumByDetail(al.getId(), timeStr, "month")).add(getManyAccountSum(al.getId(), timeStr, "month"));
String thisMonthAmountFmt = "0";
if ((thisMonthAmount.compareTo(BigDecimal.ZERO))!=0) {
thisMonthAmountFmt = df.format(thisMonthAmount);
}
al.setThismonthamount(thisMonthAmountFmt); //本月发生额
BigDecimal currentAmount = getAccountSum(al.getId(), "", "month").add(getAccountSumByHead(al.getId(), "", "month")).add(getAccountSumByDetail(al.getId(), "", "month")).add(getManyAccountSum(al.getId(), "", "month")) .add(al.getInitialamount()) ;
al.setCurrentamount(currentAmount);
resList.add(al);
}
}
return resList;
}
public Long countAccount(String name, String serialNo, String remark)throws Exception {
Long result=null;
try{
result=accountMapperEx.countsByAccount(name, serialNo, remark);
/**
*/
@RestController
@RequestMapping(value = "/functions")
public class FunctionsController {
private Logger logger = LoggerFactory.getLogger(FunctionsController.class);
@Resource
private FunctionsService functionsService;
@Resource
private UserBusinessService userBusinessService;
@PostMapping(value = "/findMenu")
public JSONArray findMenu(@RequestParam(value="pNumber") String pNumber,
@RequestParam(value="hasFunctions") String hasFunctions,
HttpServletRequest request)throws Exception {
//存放数据json数组
JSONArray dataArray = new JSONArray();
try {
String fc = hasFunctions; //当前用户所拥有的功能列表,格式如:[1][2][5]
List<Functions> dataList = functionsService.getRoleFunctions(pNumber);
if (null != dataList) {
for (Functions functions : dataList) {
JSONObject item = new JSONObject();
item.put("id", functions.getId());
List<Functions> dataList1 = functionsService.getRoleFunctions(functions.getNumber());
JSONArray dataArray1 = new JSONArray();
if (dataList1.size() != 0) {
item.put("text", functions.getName()); //是目录就没链接
item.put("icon", functions.getIcon());
for (Functions functions1 : dataList1) {
item.put("state", "open"); //如果不为空,节点展开
JSONObject item1 = new JSONObject();
List<Functions> dataList2 = functionsService.getRoleFunctions(functions1.getNumber());
if (fc.indexOf("[" + functions1.getId().toString() + "]") != -1 || dataList2.size() != 0) {
item1.put("id", functions1.getId());
JSONArray dataArray2 = new JSONArray();
if (dataList2.size() != 0) {
item1.put("text", functions1.getName());//是目录就没链接
item1.put("icon", functions1.getIcon());
for (Functions functions2 : dataList2) {
item1.put("state", "closed"); //如果不为空,节点不展开
JSONObject item2 = new JSONObject();
List<Functions> dataList3 = functionsService.getRoleFunctions(functions2.getNumber());
if (fc.indexOf("[" + functions2.getId().toString() + "]") != -1 || dataList3.size() != 0) {
item2.put("id", functions2.getId());
JSONArray dataArray3 = new JSONArray();
if (dataList3.size() != 0) {
item2.put("text", functions2.getName());//是目录就没链接
item2.put("icon", functions2.getIcon());
for (Functions functions3 : dataList3) {