基于javaweb+mysql的springboot农业物资管理系统(java+springboot+easyui+html+maven+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot农业物资管理系统(java+springboot+easyui+html+maven+mysql)
项目介绍
农业物资管理系统,管理员可以对角色进行配置,分配用户角色; 主要功能包含:登录、注册、修改密码、零售出库、零售退货、采购订单管理、采购入库管理、采购退货管理、销售管理、财务管理、报表管理、物资管理、基本资料管理。
环境需要
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版本;
6.是否Maven项目: 是;
技术栈
-
后端:springboot MyBatis
-
前端:HTML+css+javascript+jQuery+easyui
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 3. 将项目中application.properties配置文件中的数据库配置改为自己的配置; 4. 运行成功后,访问http://localhost:8080/ 到登录页面 管理员用户名:admin 密码:123456
* @return 32为ID字符串
*/
public static String getUUID_32() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
/**
* 获得当天时间,格式为yyyy-MM-dd
*
* @return 格式化后的日期格式
*/
public static String getNow() {
return new SimpleDateFormat("yyyy-MM-dd").format(new Date());
}
/**
* 获取当前月 yyyy-MM
*
* @return
*/
public static String getCurrentMonth() {
return new SimpleDateFormat("yyyy-MM").format(new Date());
}
/**
* 获取指定日期格式 yyyy-MM-dd
*
* @return
*/
public static String getCurrentMonth(Date date) {
return new SimpleDateFormat("yyyy-MM-dd").format(date);
}
/**
* 获得当天时间,格式为yyyyMMddHHmmss
*
* @return 格式化后的日期格式
*/
public static String getNow2(Date date) {
return new SimpleDateFormat("yyyyMMddHHmmss").format(date);
}
DecimalFormat df = new DecimalFormat(".##");
dha.setAllPrice(new BigDecimal(df.format(allPrice .multiply(new BigDecimal(j))))); //计算后的金额
dha.setSupplierName(dha.getSupplierName()); //供应商
dha.setoTime(dha.getoTime()); //入库出库日期
resList.add(dha);
}
}
map.put("rows", resList);
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 查询单位的累计应收和累计应付,零售不能计入
* @param supplierId
* @param endTime
* @param supType
* @param request
* @return
*/
@GetMapping(value = "/findTotalPay")
public BaseResponseInfo findTotalPay(@RequestParam("supplierId") Integer supplierId,
@RequestParam("endTime") String endTime,
@RequestParam("supType") String supType,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
JSONObject outer = new JSONObject();
BigDecimal sum = depotHeadService.findTotalPay(supplierId, endTime, supType);
outer.put("getAllMoney", sum);
map.put("rows", outer);
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
@Service
public class MaterialCategoryService {
private Logger logger = LoggerFactory.getLogger(MaterialCategoryService.class);
@Resource
private MaterialCategoryMapper materialCategoryMapper;
@Resource
private MaterialCategoryMapperEx materialCategoryMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
@Resource
private MaterialMapperEx materialMapperEx;
public MaterialCategory getMaterialCategory(long id)throws Exception {
MaterialCategory result=null;
try{
result=materialCategoryMapper.selectByPrimaryKey(id);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public List<MaterialCategory> getMaterialCategory()throws Exception {
MaterialCategoryExample example = new MaterialCategoryExample();
List<MaterialCategory> list=null;
JshException.writeFail(logger, e);
}
return result;
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialByIdsNormal(String ids) throws Exception{
/**
* 校验
* 1、单据子表 jsh_depotitem
* 是否有相关数据
* */
int deleteTotal=0;
if(StringUtils.isEmpty(ids)){
return deleteTotal;
}
String [] idArray=ids.split(",");
/**
* 校验单据子表 jsh_depotitem
* */
List<DepotItem> depotItemList =null;
try{
depotItemList= depotItemMapperEx.getDepotItemListListByMaterialIds(idArray);
}catch(Exception e){
JshException.readFail(logger, e);
}
if(depotItemList!=null&&depotItemList.size()>0){
logger.error("异常码[{}],异常提示[{}],参数,MaterialIds[{}]",
ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,ExceptionConstants.DELETE_FORCE_CONFIRM_MSG,ids);
throw new BusinessRunTimeException(ExceptionConstants.DELETE_FORCE_CONFIRM_CODE,
ExceptionConstants.DELETE_FORCE_CONFIRM_MSG);
}
/**
* 校验通过执行删除操作
* */
deleteTotal= batchDeleteMaterialByIds(ids);
return deleteTotal;
}
}
@Service
public class SupplierService {
private Logger logger = LoggerFactory.getLogger(SupplierService.class);
@Resource
private SupplierMapper supplierMapper;
@Resource
private SupplierMapperEx supplierMapperEx;
@Resource
if (sessionUser != null && username.equalsIgnoreCase(sessionUser.getLoginame())) {
logger.info("====用户 " + username + "已经登录过, login 方法调用结束====");
msgTip = "user already login";
}
//获取用户状态
int userStatus = -1;
try {
userStatus = userService.validateUser(username, password);
} catch (Exception e) {
e.printStackTrace();
logger.error(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====", e);
msgTip = "access service exception";
}
switch (userStatus) {
case ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST:
msgTip = "user is not exist";
break;
case ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR:
msgTip = "user password error";
break;
case ExceptionCodeConstants.UserExceptionCode.BLACK_USER:
msgTip = "user is black";
break;
case ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION:
msgTip = "access service error";
break;
default:
try {
msgTip = "user can login";
//验证通过 ,可以登录,放入session,记录登录日志
user = userService.getUserByUserName(username);
request.getSession().setAttribute("user",user);
if(user.getTenantId()!=null) {
Tenant tenant = tenantService.getTenantByTenantId(user.getTenantId());
if(tenant!=null) {
Long tenantId = tenant.getTenantId();
Integer userNumLimit = tenant.getUserNumLimit();
Integer billsNumLimit = tenant.getBillsNumLimit();
if(tenantId!=null) {
request.getSession().setAttribute("tenantId",tenantId); //租户tenantId
request.getSession().setAttribute("userNumLimit",userNumLimit); //用户限制数
request.getSession().setAttribute("billsNumLimit",billsNumLimit); //单据限制数
}
}
}
logService.insertLog("用户",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
} catch (Exception e) {
e.printStackTrace();
* @param macAddress
* @return
*/
public static boolean isTelNumberBySlur(String userTel) {
return Pattern.compile("^([\\s0-9]{0,12}$)").matcher(userTel).matches();
}
/**
* 获取当前时间的字符串类型
*
* @return 处理后的字符串类型
*/
public static String getNowTime() {
return new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime());
}
/**
* 开打指定文件
*
* @param filePath 文件的绝对路径
*/
public static void openFile(String filePath) {
String viewFilePath = filePath.replace("\\", "/");
// Runtime.getRuntime().exec("cmd /c start "+filePath);
// 解决路径中带空格问题
Runtime r = Runtime.getRuntime();
String[] cmdArray = new String[]{"cmd.exe", "/c", viewFilePath};
try {
r.exec(cmdArray);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 判断字符串中是否含有中文
*
* @param str
* @return
*/
public static boolean isContainsChinese(String str) {
return Pattern.compile("[\u4e00-\u9fa5]").matcher(str).matches();
}
/**
* 过滤html文件中的文本
public BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) throws Exception{
BigDecimal result= BigDecimal.ZERO;
try{
if (SUM_TYPE.equals(sumType)) {
result= depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
} else {
result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
/**
* 统计采购或销售的总金额
* @param type
* @param subType
* @param MonthTime
* @return
* @throws Exception
*/
public BigDecimal inOrOutPrice(String type, String subType, String MonthTime) throws Exception{
BigDecimal result= BigDecimal.ZERO;
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());
//查询单据主表信息
@GetMapping(value = "/exportExcel")
public void exportExcel(@RequestParam("name") String name,
@RequestParam("model") String model,
@RequestParam("categoryIds") String categoryIds,
HttpServletRequest request, HttpServletResponse response) {
try {
List<MaterialVo4Unit> dataList = materialService.findByAll(StringUtil.toNull(name), StringUtil.toNull(model),
StringUtil.toNull(categoryIds));
String[] names = {"品名", "类型", "型号", "安全存量", "单位", "零售价", "最低售价", "预计采购价", "批发价", "备注", "状态"};
String title = "商品信息";
List<String[]> objects = new ArrayList<String[]>();
if (null != dataList) {
for (MaterialVo4Unit m : dataList) {
String[] objs = new String[11];
objs[0] = m.getName();
objs[1] = m.getCategoryName();
objs[2] = m.getModel();
objs[3] = m.getSafetystock() == null? "" : m.getSafetystock().toString();
objs[4] = m.getUnit();
objs[5] = m.getRetailprice() == null ? "" : m.getRetailprice().toString();
objs[6] = m.getLowprice() == null ? "" : m.getLowprice().toString();
objs[7] = m.getPresetpriceone() == null ? "" : m.getPresetpriceone().toString();
objs[8] = m.getPresetpricetwo() == null ? "" : m.getPresetpricetwo().toString();
objs[9] = m.getRemark();
objs[10] = m.getEnabled() ? "启用" : "禁用";
objects.add(objs);
}
}
File file = ExcelUtils.exportObjectsWithoutTitle(title, names, title, objects);
ExportExecUtil.showExec(file, file.getName(), response);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* excel表格导入
* @param materialFile
* @param request
* @param response
* @return
*/
@PostMapping(value = "/importExcel")
public void importExcel(MultipartFile materialFile,
HttpServletRequest request, HttpServletResponse response) throws Exception{
* website:https://qiankunpingtai.cn
* description:
* 多次创建事务,事物之间无法协同,应该在入口处创建一个事务以做协调
*/
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
ue.setPassword(Tools.md5Encryp(ue.getPassword()));
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if (ue.getIsmanager() == null) {
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
}
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
int result=0;
try{
result= userMapperEx.addUser(ue);
}catch(Exception e){
JshException.writeFail(logger, e);
}
//更新租户id
User user = new User();
user.setId(ue.getId());
user.setTenantId(ue.getId());
userService.updateUserTenant(user);
request.getSession().setAttribute("user",user);
//新增用户与角色的关系
JSONObject ubObj = new JSONObject();
ubObj.put("type", "UserRole");
ubObj.put("keyid", ue.getId());
JSONArray ubArr = new JSONArray();
ubArr.add(manageRoleId);
ubObj.put("value", ubArr.toString());
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//创建租户信息
JSONObject tenantObj = new JSONObject();
tenantObj.put("tenantId", ue.getId());
tenantObj.put("loginName",ue.getLoginame());
String param = tenantObj.toJSONString();
tenantService.insertTenant(param, request);
logger.info("===============创建租户信息完成===============");
if (result > 0) {
return ue;
}
return null;
DepotHead depotHead = JSONObject.parseObject(beanJson, DepotHead.class);
//判断用户是否已经登录过,登录过不再处理
depotHead.setId(id);
User userInfo=userService.getCurrentUser();
depotHead.setOperpersonname(userInfo==null?null:userInfo.getUsername());
depotHead.setOpertime(new Timestamp(System.currentTimeMillis()));
try{
depotHeadMapperEx.updatedepotHead(depotHead);
}catch(Exception e){
JshException.writeFail(logger, e);
}
/**入库和出库处理预付款信息*/
if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPaytype())){
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){
/**
*/
@RestController
@RequestMapping(value = "/material")
public class MaterialController {
private Logger logger = LoggerFactory.getLogger(MaterialController.class);
@Resource
private MaterialService materialService;
@GetMapping(value = "/checkIsExist")
public String checkIsExist(@RequestParam("id") Long id, @RequestParam("name") String name,
@RequestParam("model") String model, @RequestParam("color") String color,
@RequestParam("standard") String standard, @RequestParam("mfrs") String mfrs,
@RequestParam("otherField1") String otherField1, @RequestParam("otherField2") String otherField2,
@RequestParam("otherField3") String otherField3, @RequestParam("unit") String unit,@RequestParam("unitId") Long unitId,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<String, Object>();
int exist = materialService.checkIsExist(id, name, model, color, standard, mfrs,
otherField1, otherField2, otherField3, unit, unitId);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* 批量设置状态-启用或者禁用
* @param enabled
* @param materialIDs
* @param request
private DepotHeadMapper depotHeadMapper;
@Resource
private DepotHeadMapperEx depotHeadMapperEx;
@Resource
private UserService userService;
@Resource
DepotItemService depotItemService;
@Resource
private SupplierService supplierService;
@Resource
private SerialNumberService serialNumberService;
@Resource
DepotItemMapperEx depotItemMapperEx;
@Resource
private LogService logService;
public DepotHead getDepotHead(long id)throws Exception {
DepotHead result=null;
try{
result=depotHeadMapper.selectByPrimaryKey(id);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public List<DepotHead> getDepotHead()throws Exception {
DepotHeadExample example = new DepotHeadExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<DepotHead> list=null;
try{
list=depotHeadMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<DepotHeadVo4List> select(String type, String subType, String number, String beginTime, String endTime,
String materialParam, String depotIds, int offset, int rows)throws Exception {
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int updateAccountItemWithObj(AccountItem accountItem)throws Exception {
int result=0;
try{
result = accountItemMapper.updateByPrimaryKeySelective(accountItem);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
public List<AccountItemVo4List> getDetailList(Long headerId) {
List<AccountItemVo4List> list=null;
try{
list = accountItemMapperEx.getDetailList(headerId);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated, Long headerId, String listType) throws Exception {
logService.insertLog("财务明细",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(",headerId:").append(headerId).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//转为json
JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted);
JSONArray updatedJson = JSONArray.parseArray(updated);
if (null != insertedJson) {
for (int i = 0; i < insertedJson.size(); i++) {
AccountItem accountItem = new AccountItem();
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
accountItem.setHeaderid(headerId);
if (tempInsertedJson.get("AccountId") != null && !tempInsertedJson.get("AccountId").equals("")) {
accountItem.setAccountid(tempInsertedJson.getLong("AccountId"));
}
if (tempInsertedJson.get("InOutItemId") != null && !tempInsertedJson.get("InOutItemId").equals("")) {
accountItem.setInoutitemid(tempInsertedJson.getLong("InOutItemId"));
}
if (tempInsertedJson.get("EachAmount") != null && !tempInsertedJson.get("EachAmount").equals("")) {
// Runtime.getRuntime().exec("cmd /c start "+filePath);
// 解决路径中带空格问题
Runtime r = Runtime.getRuntime();
String[] cmdArray = new String[]{"cmd.exe", "/c", viewFilePath};
try {
r.exec(cmdArray);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 判断字符串中是否含有中文
*
* @param str
* @return
*/
public static boolean isContainsChinese(String str) {
return Pattern.compile("[\u4e00-\u9fa5]").matcher(str).matches();
}
/**
* 过滤html文件中的文本
*
* @param content
* @return过滤后的文本
*/
public static String filterText(String content) {
return content.replace("/<(?:.|\\s)*?>/g", "");
}
/**
* 去掉字符串中所有符号,不论是全角,还是半角的,或是货币符号或者空格等
*
* @param s
* @return
*/
public static String removeSymbolForString(String s) {
StringBuffer buffer = new StringBuffer();
char[] chars = s.toCharArray();
for (int i = 0; i < chars.length; i++) {
if ((chars[i] >= 19968 && chars[i] <= 40869) || (chars[i] >= 97 && chars[i] <= 122) || (chars[i] >= 65 && chars[i] <= 90)) {
buffer.append(chars[i]);
}
}
list=depotMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Depot> getAllList()throws Exception {
DepotExample example = new DepotExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
example.setOrderByClause("sort");
List<Depot> list=null;
try{
list=depotMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public List<Depot> select(String name, Integer type, String remark, int offset, int rows)throws Exception {
List<Depot> list=null;
try{
list=depotMapperEx.selectByConditionDepot(name, type, remark, offset, rows);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
public Long countDepot(String name, Integer type, String remark)throws Exception {
Long result=null;
try{
result=depotMapperEx.countsByDepot(name, type, remark);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertDepot(String beanJson, HttpServletRequest request)throws Exception {
for(Material m: mList) {
materialMapper.insertSelective(m);
}
info.code = 200;
data.put("message", "成功");
} catch (Exception e) {
JshException.writeFail(logger, e);
e.printStackTrace();
info.code = 500;
data.put("message", e.getMessage());
}
info.data = data;
return info;
}
public List<Material> getMaterialEnableSerialNumberList(Map<String, Object> parameterMap)throws Exception {
List<Material> list =null;
try{
list= materialMapperEx.getMaterialEnableSerialNumberList(parameterMap);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialByIds(String ids) throws Exception{
logService.insertLog("商品",
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
int result =0;
try{
result= materialMapperEx.batchDeleteMaterialByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialByIdsNormal(String ids) throws Exception{
/**
* 校验
* 1、单据子表 jsh_depotitem
try {
List<Supplier> dataList = supplierService.findUserCustomer();
//开始拼接json数据
JSONObject outer = new JSONObject();
outer.put("id", 1);
outer.put("text", "客户列表");
outer.put("state", "open");
//存放数据json数组
JSONArray dataArray = new JSONArray();
if (null != dataList) {
for (Supplier supplier : dataList) {
JSONObject item = new JSONObject();
item.put("id", supplier.getId());
item.put("text", supplier.getSupplier());
//勾选判断1
Boolean flag = false;
try {
flag = userBusinessService.checkIsUserBusinessExist(type, keyId, "[" + supplier.getId().toString() + "]");
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>设置用户对应的客户:类型" + type + " KeyId为: " + keyId + " 存在异常!");
}
if (flag == true) {
item.put("checked", true);
}
//结束
dataArray.add(item);
}
}
outer.put("children", dataArray);
arr.add(outer);
} catch (Exception e) {
e.printStackTrace();
}
return arr;
}
/**
* 生成excel表格
* @param supplier
* @param type
* @param phonenum
* @param telephone
* @param description
* @param request