Commit 8bb5a96f authored by suichenguang's avatar suichenguang

交接单

parent 1ad57a41
package com.yxproject.start.api;
import com.yxproject.start.service.ReceiptService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("ReceiptApi")
/**
* 交接单
*/
public class ReceiptApi {
@Autowired
private ReceiptService receiptService;
/**
* 生成交接单 快证保存ACCEPT_NO 普通证保存GROUP_NO
* @param id
* @return
*/
@RequestMapping("createReceiptList")
public boolean createReceiptList(@Param("id") String id) {
//判断是否是特证
if (receiptService.selectSpecialCardByAcceptNo(id)==1){
//查询特证交接单所需数据
Map<String,Object> resultDate =receiptService.selectReceiptListDate(id);
String acceptNo = (String) resultDate.get("ACCEPT_NO");
String GAJG_DM = (String) resultDate.get("GAJG_DM");
int count = (int) resultDate.get("COUNT");
//生成特证交接单
receiptService.createReceiptList(acceptNo, GAJG_DM, count);
//查询特证详单所需数据
Map<String,Object> detailedData= receiptService.selectDetailedData(id);
String uploadNo = (String) detailedData.get("UPLOAD_NO");
String fileName = (String) detailedData.get("FILE_NAME");
String gajg_dm = (String) detailedData.get("GAJG_DM");
String cardId = (String) detailedData.get("CARD_ID");
String receiptId = (String) detailedData.get("RECIPT_ID");
String name = (String) detailedData.get("NAME");
//生成特证详单
receiptService.createDetailedList(uploadNo,fileName,gajg_dm,cardId,receiptId,name);
}else {
//查询交接单所需数据
Map<String, Object> receiptListDate = receiptService.selectReceiptListDate(id);
String groupNo = (String) receiptListDate.get("GROUP_NO");
String GAJG_DM = (String) receiptListDate.get("GAJG_DM");
int count = (int) receiptListDate.get("COUNT");
//查询这个组号是否生成了交接单
int countGroup = receiptService.selectByGroupNo(groupNo);
if (countGroup == 0) {
//生成交接单
receiptService.createReceiptList(groupNo, GAJG_DM, count);
Map<String, Object> detailedData = receiptService.selectDetailedData(id);
String uploadNo = (String) detailedData.get("UPLOAD_NO");
String fileName = (String) detailedData.get("FILE_NAME");
String gajg_dm = (String) detailedData.get("GAJG_DM");
String cardId = (String) detailedData.get("CARD_ID");
String receiptId = (String) detailedData.get("RECIPT_ID");
String name = (String) detailedData.get("NAME");
//生成详单
receiptService.createDetailedList(uploadNo, fileName, gajg_dm, cardId, receiptId, name);
} else {
//查询交接单详单数据
Map<String, Object> detailedData = receiptService.selectDetailedData(id);
String uploadNo = (String) detailedData.get("UPLOAD_NO");
String fileName = (String) detailedData.get("FILE_NAME");
String gajg_dm = (String) detailedData.get("GAJG_DM");
String cardId = (String) detailedData.get("CARD_ID");
String receiptId = (String) detailedData.get("RECIPT_ID");
String name = (String) detailedData.get("NAME");
//生成详单
receiptService.createDetailedList(uploadNo, fileName, gajg_dm, cardId, receiptId, name);
}
//查询有几个
int specialCardCount =receiptService.selectSpecialCard(groupNo);
receiptService.detailedTallyDown(specialCardCount,groupNo);
}
return true;
}
}
package com.yxproject.start.mapper;
import org.apache.ibatis.annotations.*;
import java.util.Map;
@Mapper
public interface ReceiptMapper {
//根据身份证号查询交接单信息
@Select("select prod_group_t.group_no,prod_card_t.accept_no,subStr(prod_card_t.UPLOAD_NO,0,9) as GAJG_DM,prod_group_t.valid_count\n" +
"from prod_card_t@PROD_LINK\n" +
"left join prod_group_t@PROD_LINK on subStr(prod_card_t.accept_no,0,8)= prod_group_t.group_no\n" +
"where prod_card_t.id_no=#{id}")
public Map<String,Object> selectReceiptListDate(String id);
//查询这个组号是否已经生成交接单
@Select("select count(*) from receipt_list where QR_CODE=#{groupNo}")
public int selectByGroupNo(String groupNo);
//生成交接单
@Insert("INSERT INTO RECEIPT_LIST(QR_CODE,POLICE_CODE,FINISH_COUNT,CHECK_DATE,CHECK_NAME,STATE)" +
"VALES(#{GROUP_NO},#{GAJG_DM},#{count},#{CHECK_DATE},#{CHECK_NAME},#{STATE})")
public boolean createReceiptList(@Param("GROUP_NO")String GROUP_NO,@Param("GAJG_DM")String GAJG_DM,@Param("count")int count);
//根据身份证号查询交接单详单信息
@Select("select prod_card_t.upload_no,prepro_person.file_id,subStr(prod_card_t.UPLOAD_NO,0,9) AS GAJG_DM,\n" +
"prod_card_t.id_no,receipt_list.ID,prod_card_t.name\n" +
"from prod_card_t@PROD_LINK\n" +
"left join prepro_person on prod_card_t.upload_no= prepro_person.jmsfzslh\n" +
"left join receipt_list on receipt_list.QR_CODE = subStr(prod_card_t.accept_no,0,8)\n" +
"where prod_card_t.id_no=#{id}")
public Map<String,Object>selectDetailedData(String id);
//生成交接单详单
@Insert("INSERT INTO CARD_DETAILED_LIST (UPLOAD_NO,FILE_NAME,POLICE_CODE,CARD_ID,RECIPT_ID,NAME)" +
"VALUES(#{UPLOAD_NO},#{FILE_NAME},#{GAJG_DM},#{CARD_ID},#{RECIPT_ID},#{NAME})")
public boolean createDetailedList(@Param("UPLOAD_NO")String UPLOAD_NO,@Param("FILE_NAME")String FILE_NAME,@Param("GAJG_DM")String GAJG_DM,@Param("CARD_ID")String CARD_ID,@Param("RECIPT_ID")String RECIPT_ID,@Param("NAME")String NAME);
//根据组号查询特证表
@Select("SELECT count(*) FROM SPECIAL_CARD WHERE subStr(ACCEPT_NO,0,8) =#{GROUP_NO}")
public int selectSpecialCard(String GROUP_NO);
//交接单数量减count
@Update("UPDATE RECEIPT_LIST \n" +
"SET FINISH_COUNT=(\n" +
"(SELECT COUNT(*) FROM RECEIPT_LIST\n" +
"WHERE QR_CODE=#{GROUP_NO})-#{COUNT})")
public boolean detailedTallyDown(int COUNT,String GROUP_NO);
//根据身份证号查询特证表
@Select("select count(*) from SPECIAL_CARD \n" +
"left join prod_card_t@prod_link on special_card.accept_no = prod_card_t.accept_no\n" +
"where prod_card_t.id_no = #{id}")
public int selectSpecialCardByAcceptNo(String id);
}
package com.yxproject.start.service;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
public interface ReceiptService {
public Map<String,Object> selectReceiptListDate(String id);
public boolean createReceiptList(@Param("GROUP_NO")String GROUP_NO, @Param("GAJG_DM")String GAJG_DM, @Param("count")int count);
public Map<String,Object>selectDetailedData(String id);
public boolean createDetailedList(@Param("UPLOAD_NO")String UPLOAD_NO,@Param("FILE_NAME")String FILE_NAME,@Param("GAJG_DM")String GAJG_DM,@Param("CARD_ID")String CARD_ID,@Param("RECEIPT_ID")String RECIPT_ID,@Param("NAME")String NAME);
public int selectSpecialCard(String GROUP_NO);
public boolean detailedTallyDown(int COUNT,String GROUP_NO);
public int selectByGroupNo(String groupNo);
public int selectSpecialCardByAcceptNo(String id);
}
package com.yxproject.start.service.impl;
import com.yxproject.start.mapper.ReceiptMapper;
import com.yxproject.start.service.ReceiptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class ReceiptServiceImpl implements ReceiptService {
@Autowired
private ReceiptMapper receiptMapper;
@Override
public Map<String,Object> selectReceiptListDate(String id) {
Map<String,Object> result= receiptMapper.selectReceiptListDate(id);
return result;
}
@Override
public boolean createReceiptList(String GROUP_NO, String GAJG_DM, int count) {
receiptMapper.createReceiptList(GROUP_NO,GAJG_DM,count);
return true;
}
@Override
public Map<String, Object> selectDetailedData(String id) {
Map<String,Object> resultMap = receiptMapper.selectDetailedData(id);
return resultMap;
}
@Override
public boolean createDetailedList(String UPLOAD_NO, String FILE_NAME, String GAJG_DM, String CARD_ID, String RECIPT_ID, String NAME) {
receiptMapper.createDetailedList(UPLOAD_NO,FILE_NAME,GAJG_DM,CARD_ID,RECIPT_ID,NAME);
return true;
}
@Override
public int selectSpecialCard(String GROUP_NO) {
int count = receiptMapper.selectSpecialCard(GROUP_NO);
return count;
}
@Override
public boolean detailedTallyDown(int COUNT, String GROUP_NO) {
receiptMapper.detailedTallyDown(COUNT,GROUP_NO);
return true;
}
@Override
public int selectByGroupNo(String groupNo) {
int countGroup= receiptMapper.selectByGroupNo(groupNo);
return countGroup;
}
@Override
public int selectSpecialCardByAcceptNo(String id) {
int countSpecial =receiptMapper.selectSpecialCardByAcceptNo(id);
return countSpecial;
}
}
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