Commit 4659c06d authored by wyh's avatar wyh

批量审核 批量展示

parent 9c5bc464
......@@ -18,6 +18,7 @@ import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.SysUser;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.SysUserService;
@Controller
......@@ -117,4 +118,26 @@ public class StoreController extends BaseController {
}
return result;
}
/**
* 批量审核
* @param workerIds
* @return
*/
@RequestMapping("batchStores")
@ResponseBody
public ResultInfo<Store> batchStores(String[] storeIds) {
return storeService.batchStoreUpdate(storeIds, getOperator());
}
/**
* 批量展示
* @param workerIds
* @return
*/
@RequestMapping("batchStoreShop")
@ResponseBody
public ResultInfo<Store> batchStoreShop(String[] storeIds) {
return storeService.batchStoreShopping(storeIds, getOperator());
}
}
......@@ -6,6 +6,7 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.Operator;
......
......@@ -8,4 +8,9 @@ import cn.com.fqy.core.model.Store;
*/
public interface StoreDao extends BaseDao<Store,String> {
public int updateAdByIds(String[] ids);
public int updateShopByIds(String[] ids);
}
......@@ -15,4 +15,8 @@ public interface WorkerDao extends BaseDao<Worker,String> {
* @return
*/
public List<Worker> getWorkerByIds(String[] ids);
public int updateAdByIds(String[] ids);
public int updateShopByIds(String[] ids);
}
......@@ -8,6 +8,7 @@ import cn.com.fqy.core.common.BaseService;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
/**
* Store 服务接口类
......@@ -78,4 +79,15 @@ public interface StoreService extends BaseService {
*/
public void fillDefaultValues(Store obj);
/**
* 根据 一组ID 修改一组数据
* @param workerId
* @return
*/
public ResultInfo<Store> batchStoreUpdate(String[] storeIds,Operator operator);
public ResultInfo<Store> batchStoreShopping(String[] storeIds,Operator operator);
}
......@@ -21,6 +21,7 @@ import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.dao.StoreDao;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.StoreService;
/**
......@@ -298,4 +299,52 @@ public class StoreServiceImpl implements StoreService {
}
}
@Transactional
public ResultInfo<Store> batchStoreUpdate(String[] storeIds, Operator operator) {
ResultInfo<Store> resultInfo = new ResultInfo<Store>();
if (storeIds == null || storeIds.length == 0) {
log.info(Constant.ERR_MSG_INVALID_ARG + " storeIds is null or empty array.");
} else {
try {
//调用dao,根据主键数组查询
int count=storeDao.updateAdByIds(storeIds);
if (count > 0) {
resultInfo.setCode(Constant.SUCCESS);
} else {
resultInfo.setCode(Constant.FAIL);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
}
}
return resultInfo;
}
@Transactional
public ResultInfo<Store> batchStoreShopping(String[] storeIds, Operator operator) {
ResultInfo<Store> resultInfo = new ResultInfo<Store>();
if (storeIds == null || storeIds.length == 0) {
log.info(Constant.ERR_MSG_INVALID_ARG + " storeIds is null or empty array.");
} else {
try {
//调用dao,根据主键数组查询
int count=storeDao.updateShopByIds(storeIds);
if (count > 0) {
resultInfo.setCode(Constant.SUCCESS);
} else {
resultInfo.setCode(Constant.FAIL);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
}
}
return resultInfo;
}
}
......@@ -322,26 +322,51 @@ public class WorkerServiceImpl implements WorkerService {
return list;
}
@Override
@Transactional
public ResultInfo<Worker> batchWorkerUpdate(String[] workerIds,Operator operator) {
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>();
for (String id : workerIds) {
Worker worker =new Worker();
worker.setWorkerId(id);
worker.setIsAuditing(1);
resultInfo = updateWorker(worker,operator);
if (workerIds == null || workerIds.length == 0) {
log.info(Constant.ERR_MSG_INVALID_ARG + " workerIds is null or empty array.");
} else {
try {
//调用dao,根据主键数组查询
int count=workerDao.updateAdByIds(workerIds);
if (count > 0) {
resultInfo.setCode(Constant.SUCCESS);
} else {
resultInfo.setCode(Constant.FAIL);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
}
}
return resultInfo;
}
@Override
@Transactional
public ResultInfo<Worker> batchWorkerShopping(String[] workerIds, Operator operator) {
ResultInfo<Worker> resultInfo = new ResultInfo<Worker>();
for (String id : workerIds) {
Worker worker =new Worker();
worker.setWorkerId(id);
worker.setIsShopping(1);;
resultInfo = updateWorker(worker,operator);
if (workerIds == null || workerIds.length == 0) {
log.info(Constant.ERR_MSG_INVALID_ARG + " workerIds is null or empty array.");
} else {
try {
//调用dao,根据主键数组查询
int count=workerDao.updateShopByIds(workerIds);
if (count > 0) {
resultInfo.setCode(Constant.SUCCESS);
} else {
resultInfo.setCode(Constant.FAIL);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
resultInfo.setCode(Constant.FAIL);
resultInfo.setMsg(Constant.ERR_MSG_EXCEPTION_CATCHED);
}
}
return resultInfo;
}
......
......@@ -258,6 +258,18 @@ CITY_NAME,CITY_ID,PROVINCE_ID,COUNTY_ID,BRIEF
</where>
</update>
<update id="updateAdByIds">
update T_STORE set IS_AUDITING=1
<where>
STORE_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</update>
<update id="updateShopByIds">
update T_STORE set IS_SHOPPING=1
<where>
STORE_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</update>
<delete id="delete">
delete from T_STORE
<where>
......
......@@ -232,6 +232,18 @@ UPDATE_TIME,OPERATOR_ID,OPERATOR_TYPE,SERIAL_NUMBER,IS_DELETED,STORE_NAME,BRIEF
</where>
</update>
<update id="updateAdByIds" >
update T_WORKER set IS_AUDITING=1
<where>
WORKER_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</update>
<update id="updateShopByIds" >
update T_WORKER set IS_SHOPPING=1
<where>
WORKER_ID in <foreach item="item" index="index" collection="array" open="(" separator="," close=")">#{item}</foreach>
</where>
</update>
<delete id="delete">
delete from T_WORKER
<where>
......
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