Commit a20cc3be authored by dahai's avatar dahai

修改更改任务单状态API

parent 6f53b218
...@@ -17,10 +17,8 @@ import sun.net.idn.StringPrep; ...@@ -17,10 +17,8 @@ import sun.net.idn.StringPrep;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.util.ArrayList; import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* @author Administrator * @author Administrator
...@@ -77,15 +75,21 @@ public class TaskListApi { ...@@ -77,15 +75,21 @@ public class TaskListApi {
/** /**
* 更改任务单状态 * 更改任务单状态
* (用于任务单下发) * taskId 任务单ID
* @param taskId 任务单ID * name 下发人姓名
* @param name 下发人姓名 * process 下发人所在工序
* @param process 下发人所在工序
* @return * @return
*/ */
@RequestMapping("updateState") @RequestMapping("updateState")
public boolean updateState(@RequestParam("taskId") String taskId,@RequestParam("process") String process,@RequestParam("name")String name){
return taskListService.updateState(taskId,process,name); public boolean updateState(@RequestBody String json){
JSONObject jsonObject = JSONObject.fromObject(json);
JSONArray jsonArray =(JSONArray)jsonObject.get("taskIdList");
String process = jsonObject.get("process").toString();
String name = jsonObject.get("name").toString();
Boolean b = true;
List<String> list= (List<String>)jsonArray;
return taskListService.updateState(list,process,name);
} }
/** /**
...@@ -190,8 +194,201 @@ public class TaskListApi { ...@@ -190,8 +194,201 @@ public class TaskListApi {
*/ */
@RequestMapping("createFastTask") @RequestMapping("createFastTask")
@Transactional @Transactional
public String createFastTask(@RequestBody String str, HttpServletResponse resp){ public String createFastTask(@RequestParam("acceptNo") String acceptNo, HttpServletResponse resp){
//todo //todo
// JSONObject jsonObject = (JSONObject) object;
// String cardID = jsonObject.getString("cardID");
// String makeType = jsonObject.getString("makeType");
// String cityCode = jsonObject.getString("cityCode");
// if ("null".equals(cityCode.substring(0, 4))) {
// cityCode = "000000";
// }
// String createDate = df2.format(new Date());
// if ("null".equals(createDate + "")) {
// createDate = df2.format(new Date()).substring(0, 8);
// }
// List<Object[]> list = processinfoDao.querySpecialCardInfo(cardID.substring(0, 8));
// String queryGroupMakeType = groupinfoDao.queryGroupMakeType(cardID.substring(0, 8));
// /**
// * 未保存循环单 在受理库中添加快证
// */
// try {
// if (list.size() == 0) {
// //添加快证时保存派出所上传照片的情况
// ManagerACC managerACC = (ManagerACC) SpringBeanUtil.getContext().getBean("managerACC");
// List<String> stringList = new ArrayList<>();
// stringList.add("('" + cardID.substring(0, 8) + "')");
// List<Object[]> policeStationInfo = managerACC.getPoliceStationInfo(stringList);
// int i1 = 0;
// while (i1 == 0) {
// i1 = updatePoliceStationInfo(policeStationInfo);
// }
// //生成快证循环单
// String cycleid = updateCycleSheet(1 + "", df2.format(new Date()), cityCode.substring(0, 4) + "00", createDate, 1 + "", 0 + "", "", "", "1", Long.valueOf(queryGroupMakeType));
// //插入新的组
// GroupinfoEntity groupinfoEntity1 = new GroupinfoEntity();
// groupinfoEntity1.setGroupinfoid(groupinfoDao.findCount(GroupinfoEntity.class) + 1);
// groupinfoEntity1.setCyclesheetid(cycleid);
// groupinfoEntity1.setCount(Long.valueOf(1));
// groupinfoEntity1.setType(Long.valueOf(1));
// groupinfoEntity1.setGroupNo(cardID);
// groupinfoDao.update(groupinfoEntity1);
// //快证循环单添加工序
// ProcessinfoEntity processinfoEntity1 = new ProcessinfoEntity();
// processinfoEntity1.setCyclesheet(cycleid);
// processinfoEntity1.setProcessid(processinfoDao.queryProcessID() + 1);
// processinfoEntity1.setProcess(1 + "");
// processinfoEntity1.setCreatedate(df2.format(new Date()));
// processinfoDao.update(processinfoEntity1);
// String sql = "select DATA_VERIFICATION_SEQ.currval,DATA_VERIFICATION_SEQ.NEXTVAL from dual";
// List<Object[]> listWithSQL = dataVerificationEntityDao.findListWithSQL(sql);
// AutoCreateCycleID autoCreateCycleID = new AutoCreateCycleID();
// String dataVerificationID = autoCreateCycleID.createCycleID(listWithSQL.get(0)[0] + "");
// SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyyMMdd");
// DataVerificationEntity dataVerificationEntity = new DataVerificationEntity();
// dataVerificationEntity.setDataVerificationId(dataVerificationID);
// dataVerificationEntity.setCitycode(cityCode.substring(0, 4) + "00");
// dataVerificationEntity.setMaketype(Long.valueOf(queryGroupMakeType));
// dataVerificationEntity.setSaveDate(simpleDateFormat2.format(new Date()));
// dataVerificationEntity.setValidCount((long) 1);
// dataVerificationEntity.setInvalidCount((long) 0);
// dataVerificationEntityDao.update(dataVerificationEntity);
//
// List<Object[]> groupInfoList = groupinfoDao.queryGroupInfoAtAcc(cardID.substring(0, 8));
// int i = Integer.valueOf((groupInfoList.get(0)[1]).toString()) - 1;
// /**
// * 判断组内剩下的人数
// * 如果超过1人 则加入新的循环单
// *
// */
// if (i > 0) {
// String cycleid1 = updateCycleSheet(makeType, df2.format(new Date()), cityCode.substring(0, 4) + "00", createDate, i + "", groupInfoList.get(0)[2].toString(), "", "", "0", Long.valueOf(-1));
// GroupinfoEntity groupinfoEntity2 = new GroupinfoEntity();
// //插入组号原有的信息
//// long count = groupinfoDao.findCount(GroupinfoEntity.class);
// long count = groupinfoDao.queryGroupinfoCount();
// groupinfoEntity2.setGroupinfoid(count + 1);
// groupinfoEntity2.setCyclesheetid(cycleid1);
// groupinfoEntity2.setCount(Long.valueOf(groupInfoList.get(0)[1].toString()));
// groupinfoEntity2.setGroupNo(cardID.substring(0, 8));
// groupinfoDao.update(groupinfoEntity2);
// //插入快证的信息
// GroupinfoEntity groupinfoEntity3 = new GroupinfoEntity();
// groupinfoEntity3.setGroupinfoid(groupinfoDao.findCount(GroupinfoEntity.class) + 1);
// groupinfoEntity3.setCyclesheetid(cycleid1);
// groupinfoEntity3.setCount(Long.valueOf("-1"));
// groupinfoEntity3.setGroupNo(cardID);
// groupinfoEntity3.setType(Long.valueOf("1"));
// groupinfoDao.update(groupinfoEntity3);
// }
// yxresp.outPutSuccess("1");
// } else if (list.size() == 1) {
// /**]
// * 已保存循环单 在盈信库中 添加快证
// */
// //更新原来循环单数据核验数量
// cyclesheetinfoEntityDao.updateCycleSheetInfoVaild(list.get(0)[0].toString());
// GroupinfoEntity groupinfoEntity = new GroupinfoEntity();
// groupinfoEntity.setGroupNo(cardID);
// groupinfoEntity.setType((long) 1);
// groupinfoEntity.setCount(0 - Long.valueOf(1));
// groupinfoEntity.setCyclesheetid(list.get(0)[0].toString());
// groupinfoEntity.setGroupinfoid(groupinfoDao.findCount(GroupinfoEntity.class) + 1);
// groupinfoDao.update(groupinfoEntity);
// //插入新的循环单
//// CyclesheetinfoEntity findcyclesheetinfoEntity = cyclesheetinfoEntityDao.findCyclesheetinfoEntityByCycleID(groupinfoEntity.getCyclesheetid());
//// //在新的余证循环单中添加原有循环单的生成时间
//// String cycleid = updateCycleSheetBySQL(1 + "", findcyclesheetinfoEntity.getSubmitdate(), findcyclesheetinfoEntity.getCitycode(), findcyclesheetinfoEntity.getCreatedate(), 1 + "", 0 + "", findcyclesheetinfoEntity.getWorkshop(), findcyclesheetinfoEntity.getMachine(), "1");
//
//// 插入新的循环单
// String cycleid = updateCycleSheet(1 + "", df2.format(new Date()), list.get(0)[3].toString(), df2.format(new Date()), 1 + "", 0 + "", ((list.get(0)[7] == null) ? "" : list.get(0)[7].toString()), ((list.get(0)[8] == null) ? "" : list.get(0)[8].toString()), "1", Long.valueOf(queryGroupMakeType));
// //插入新的组
// GroupinfoEntity groupinfoEntity1 = new GroupinfoEntity();
// long count = groupinfoDao.findCount(GroupinfoEntity.class);
// groupinfoEntity1.setGroupinfoid(count + 1);
// groupinfoEntity1.setCyclesheetid(cycleid);
// groupinfoEntity1.setCount(Long.valueOf(1));
// groupinfoEntity1.setType(Long.valueOf(1));
// groupinfoEntity1.setGroupNo(cardID);
// groupinfoDao.update(groupinfoEntity1);
// //在未下发循环单中添加快证 工序为null设置为 1
// if (list.get(0)[11] == null) {
// ProcessinfoEntity processinfoEntity1 = new ProcessinfoEntity();
// processinfoEntity1.setCyclesheet(cycleid);
// processinfoEntity1.setProcessid(processinfoDao.queryProcessID() + 1);
// processinfoEntity1.setProcess("1");
// processinfoEntity1.setCreatedate(df2.format(new Date()));
// processinfoDao.update(processinfoEntity1);
// } else {
// int num = Integer.valueOf((list.get(0)[11] == null ? null : list.get(0)[11].toString()));
// for (int i = 1; i <= num; i++) {
// ProcessinfoEntity processinfoEntity1 = new ProcessinfoEntity();
// processinfoEntity1.setCyclesheet(cycleid);
// processinfoEntity1.setProcessid(processinfoDao.queryProcessID() + 1);
// processinfoEntity1.setProcess(i + "");
// processinfoEntity1.setCreatedate(df2.format(new Date()));
// processinfoDao.update(processinfoEntity1);
// }
// }
// yxresp.outPutSuccess("1");
// } else {
// /**
// * 已经成为余证或者废证 添加快证
// */
// List<GroupinfoEntity> groupinfoEntities = groupinfoDao.queryGroupInfoEntityList(cardID);
// /**
// * 判断是否是余证 添加快证
// */
// if (groupinfoEntities.get(0).getType() == 2) {
// for (GroupinfoEntity groupinfoEntity : groupinfoEntities) {
// /**
// * 修改组号表中 余证 改快证
// */
// groupinfoEntity.setType(Long.valueOf(1));
// groupinfoDao.update(groupinfoEntity);
// if (groupinfoEntity.getCount() == 1) {
// /**
// * 找到余证循环单 改为快证循环单
// */
// CyclesheetinfoEntity cyclesheetinfoEntity = cyclesheetinfoEntityDao.queryCyclesheetinfoEntityByCycleID(groupinfoEntity.getCyclesheetid());
// cyclesheetinfoEntity.setMktype(Long.valueOf(1));
// cyclesheetinfoEntity.setWorkshop(null);
// cyclesheetinfoEntityDao.update(cyclesheetinfoEntity);
// }
// }
// } else {
// /**
// * 废证 添加快证
// */
// for (GroupinfoEntity groupinfoEntity : groupinfoEntities) {
// /**
// * 修改组号表中 废证 改快证
// */
// groupinfoEntity.setType(Long.valueOf(1));
// groupinfoDao.update(groupinfoEntity);
// if (groupinfoEntity.getCount() == 1) {
// /**
// * 找到废证循环单 改为快证循环单
// */
// CyclesheetinfoEntity cyclesheetinfoEntity = cyclesheetinfoEntityDao.queryCyclesheetinfoEntityByCycleID(groupinfoEntity.getCyclesheetid());
// cyclesheetinfoEntity.setMktype(Long.valueOf(1));
// cyclesheetinfoEntity.setIsshow(Long.valueOf(1));
// cyclesheetinfoEntity.setWorkshop(null);
// cyclesheetinfoEntityDao.update(cyclesheetinfoEntity);
// }
// if (groupinfoEntity.getCount() == -1) {
// //更新原来循环单数据核验数量
// cyclesheetinfoEntityDao.updateCycleSheetInfoVaild(groupinfoEntity.getCyclesheetid());
// }
// }
// }
// yxresp.outPutSuccess("1");
// }
// } catch (Exception e) {
// logger.error("添加快证循环单在制证库异常 addQuickCyclesheetInfoImpl" + " cardID " + cardID + " makeType " + makeType + " cityCode " + cityCode + "createDate" + createDate);
// logger.error("", e.fillInStackTrace());
// throw e;
// }
return null; return null;
} }
......
...@@ -18,7 +18,7 @@ public interface TaskListService { ...@@ -18,7 +18,7 @@ public interface TaskListService {
public boolean createTaskList(List<TaskListEntity> resultMap); public boolean createTaskList(List<TaskListEntity> resultMap);
public boolean updateState(String taskId,String process,String name); public boolean updateState(List<String> list,String process,String name);
public List<Object> selectByCountyAtACCU(String date); public List<Object> selectByCountyAtACCU(String date);
......
...@@ -12,6 +12,7 @@ import com.yxproject.start.service.TaskListService; ...@@ -12,6 +12,7 @@ import com.yxproject.start.service.TaskListService;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.jws.Oneway; import javax.jws.Oneway;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -52,31 +53,35 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -52,31 +53,35 @@ public class TaskListServiceImpl implements TaskListService {
} }
@Override @Override
public boolean updateState(String taskId,String process,String name) { @Transactional(rollbackFor = Exception.class)
switch (process){ public boolean updateState(List<String> list,String process,String name) {
case "1": for (String taskId: list) {
taskListMapper.updateState1(taskId,process,name); switch (process){
break; case "1":
case "2": taskListMapper.updateState1(taskId,process,name);
taskListMapper.updateState2(taskId,process,name); break;
break; case "2":
case "3": taskListMapper.updateState2(taskId,process,name);
taskListMapper.updateState3(taskId,process,name); break;
break; case "3":
case "4": taskListMapper.updateState3(taskId,process,name);
taskListMapper.updateState4(taskId,process,name); break;
break; case "4":
case "5": taskListMapper.updateState4(taskId,process,name);
taskListMapper.updateState5(taskId,process,name); break;
break; case "5":
case "6": taskListMapper.updateState5(taskId,process,name);
taskListMapper.updateState6(taskId,process,name); break;
break; case "6":
case "7": taskListMapper.updateState6(taskId,process,name);
taskListMapper.updateState7(taskId,process,name); break;
break; case "7":
default: taskListMapper.updateState7(taskId,process,name);
break; break;
default:
break;
}
} }
return true; return true;
} }
...@@ -209,6 +214,7 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -209,6 +214,7 @@ public class TaskListServiceImpl implements TaskListService {
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public List<Object> selectByCountyAtAuxiliary(long process) { public List<Object> selectByCountyAtAuxiliary(long process) {
//查询普通组号列表 在辅助库中 //查询普通组号列表 在辅助库中
List<Map<String, Object>> mapList_common = taskListMapper.selectByCountyAtAuxiliary_common(process); List<Map<String, Object>> mapList_common = taskListMapper.selectByCountyAtAuxiliary_common(process);
...@@ -258,6 +264,7 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -258,6 +264,7 @@ public class TaskListServiceImpl implements TaskListService {
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean saveTask(TaskEntity taskEntity) { public boolean saveTask(TaskEntity taskEntity) {
return taskListMapper.saveTask(taskEntity); return taskListMapper.saveTask(taskEntity);
} }
...@@ -268,6 +275,7 @@ public class TaskListServiceImpl implements TaskListService { ...@@ -268,6 +275,7 @@ public class TaskListServiceImpl implements TaskListService {
* @return * @return
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean saveTask(List<Object> list,String submitName,String process) { public boolean saveTask(List<Object> list,String submitName,String process) {
Map<String,Object> stringObjectMap =(Map<String,Object>)list.get(0); Map<String,Object> stringObjectMap =(Map<String,Object>)list.get(0);
TaskEntity taskEntity = new TaskEntity(); TaskEntity taskEntity = new TaskEntity();
......
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