|
|
@@ -20,8 +20,10 @@ import java.util.UUID;
|
|
|
import javax.mail.MessagingException;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.dao.*;
|
|
|
import com.goafanti.common.model.*;
|
|
|
+import com.goafanti.common.utils.excel.NewExcelUtil;
|
|
|
import com.goafanti.order.bo.*;
|
|
|
import com.goafanti.order.enums.*;
|
|
|
import com.goafanti.organization.bo.*;
|
|
|
@@ -34,6 +36,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -130,6 +133,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
private BusinessProjectMapper businessProjectMapper;
|
|
|
@Autowired
|
|
|
private BusinessCategoryMapper businessCategoryMapper;
|
|
|
+ @Value(value = "${upload.path}")
|
|
|
+ private String uploadPath = null;
|
|
|
|
|
|
Logger logger = LoggerFactory.getLogger(OrderNewServiceImpl.class);
|
|
|
|
|
|
@@ -298,6 +303,11 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
@Override
|
|
|
public List<TOrderTaskBo> selectOrderTask(String orderNo,Integer type) {
|
|
|
+ if (TokenManager.hasRole(AFTConstants.SALESMAN)||TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)){
|
|
|
+ if (type==null)type=0;
|
|
|
+ }else {
|
|
|
+ if (type==null)type=1;
|
|
|
+ }
|
|
|
List<TOrderTaskBo> list=tOrderTaskMapper.selectOrderTask(orderNo,type);
|
|
|
for (TOrderTaskBo t : list) {
|
|
|
if (TokenManager.hasRole(AFTConstants.SALESMAN)&&TokenManager.hasRole(AFTConstants.TECH)) {
|
|
|
@@ -874,9 +884,22 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
}
|
|
|
if(i!=null)params.put("shiroType", i);
|
|
|
Pagination<outOrderDunListBo> p = (Pagination<outOrderDunListBo>)findPage("selectDunOrderNewListByPage", "selectDunOrderNewListCount", params, pageNo, pageSize);
|
|
|
+ List<outOrderDunListBo> list = (List<outOrderDunListBo>) p.getList();
|
|
|
+ for (outOrderDunListBo o : list) {
|
|
|
+ o.setDunSubject(getDunSubject(o));
|
|
|
+ }
|
|
|
return p;
|
|
|
}
|
|
|
|
|
|
+ public String getDunSubject(outOrderDunListBo o) {
|
|
|
+ //旧催款
|
|
|
+ if(o.getDunSubject()!=null)return OrderDunSubject.getValueByCode(Integer.valueOf(o.getDunSubject()));
|
|
|
+ //新催款
|
|
|
+ if(o.getDunType()!=null&&o.getDunType()!=0&&o.getProjectType()!=null)return NewOrderDunType.getValueByCode(Integer.valueOf(""+o.getProjectType()+o.getDunType()));
|
|
|
+ if(o.getDunType()!=null&&o.getDunType()==0&&o.getProjectType()!=null)return NewOrderDunType.getValueByCode(Integer.valueOf(""+o.getProjectType()+o.getDunType()))+o.getCustomizeName();
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public int createDunLog( String dunId, String dumTime, String remarks, String attUrl) {
|
|
|
TDunLog d=new TDunLog();
|
|
|
@@ -1093,67 +1116,14 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
@Override
|
|
|
- public void exportOrderDunData(String name,String orderNo,String contractNo,String starTime,String endTime,Integer specially,String aid,String adminName,
|
|
|
- String depId,Integer newStatus,Integer approval,Integer amountStatus,Integer memberType,
|
|
|
- Integer pageNo,Integer pageSize,HttpServletResponse response) throws Exception {
|
|
|
- OutputStream out = response.getOutputStream();
|
|
|
- try {
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
+ public Result exportOrderDunData(String name, String orderNo, String contractNo, String starTime, String endTime, Integer specially, String aid, String adminName,
|
|
|
+ String depId, Integer newStatus, Integer approval, Integer amountStatus, Integer memberType,
|
|
|
+ Integer pageNo, Integer pageSize){
|
|
|
+
|
|
|
List<outOrderDunListBo> list=(List<outOrderDunListBo>) dunOrderNewList( name, orderNo, contractNo, starTime, endTime,specially,
|
|
|
aid, adminName, depId,newStatus, approval, amountStatus, memberType, pageNo, pageSize).getList();
|
|
|
-
|
|
|
- String[] comment = {"合同编号","订单编号","客户名称","订单负责人","订单部门","订单状态","签单金额","应收款","已收款","拨款比例","结算状态","未收款","项目状态","催收科目","催款状态","催款启动时间","签单时间"};
|
|
|
- String fileName ="催款信息记录表" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()) + ".xls";
|
|
|
- //type 0 变更
|
|
|
- XSSFWorkbook wb =ExportExcelUtil.exportTemplateInfoS(comment,"催款信息");
|
|
|
- //根据列表编写文档
|
|
|
- XSSFSheet sheet =wb.getSheetAt(0);
|
|
|
- for (outOrderDunListBo ob : list) {
|
|
|
- //新增一行
|
|
|
- XSSFRow r = sheet.createRow(sheet.getLastRowNum()+1);
|
|
|
- for (int i = 0; i < comment.length; i++) {
|
|
|
- //当前列的只
|
|
|
- String o = "";
|
|
|
- switch (comment[i]) {
|
|
|
-// "合同编号","订单编号","客户名称","订单负责人","订单部门","订单状态","项目负责人","签单金额","结算状态","已收款","应收款","项目状态","催收科目","催款启动时间"
|
|
|
- case "合同编号": o = ob.getContractNo(); break;
|
|
|
- case "订单编号": o = ob.getOrderNo(); break;
|
|
|
- case "客户名称": o = ob.getUserName(); break;
|
|
|
- case "订单负责人": o = ob.getSalesmanName(); break;
|
|
|
- case "订单部门": o = ob.getDepName(); break;
|
|
|
- case "订单状态": o = OrderNewState.getValueByCode(ob.getOrderStatus());break;
|
|
|
- case "签单金额": o = ob.getTotalAmount().toString(); break;
|
|
|
- case "已收款": o = bigToString(ob.getSettlementAmount()); break;
|
|
|
- case "未收款": o = bigToString(ob.getUncollectedAmount()); break;
|
|
|
- case "拨款比例": o = bigToString(ob.getAppropriationRatio()); break;
|
|
|
- case "结算状态": o = LiquidationNewState.getValueByCode(ob.getLiquidationStatus()); break;
|
|
|
- case "应收款": o = bigToString(ob.getAccountsReceivable()); break;
|
|
|
- case "项目状态": o = NewProjectStatus.getValueByCode(ob.getProjectStatus()); break;
|
|
|
- case "催收科目": o = ob.getDunSubject(); break;
|
|
|
- case "催款状态": o = ob.getDunStatus()==0?"未启动":"已启动"; break;
|
|
|
- case "催款启动时间": o = ob.getStartDate(); break;
|
|
|
- case "签单时间": o = ob.getSignDate(); break;
|
|
|
- default: o = ""; break;
|
|
|
- }
|
|
|
- XSSFCell c = r.createCell(i);
|
|
|
- c.setCellValue(o);
|
|
|
- }
|
|
|
- }
|
|
|
- //返回名称及参数
|
|
|
- response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(),"iso-8859-1"));
|
|
|
- response.setContentType("application/octet-stream;charset=utf-8");
|
|
|
- // 返回数据流
|
|
|
- wb.write(out);
|
|
|
- out.flush();
|
|
|
- out.close();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- throw new BusinessException(new Error("表格生成错误。"));
|
|
|
- }finally {
|
|
|
- out.flush();
|
|
|
- out.close();
|
|
|
- }
|
|
|
-
|
|
|
+ NewExcelUtil<outOrderDunListBo> excelUtil = new NewExcelUtil<>(outOrderDunListBo.class);
|
|
|
+ return excelUtil.exportExcel(list,"催款截点统计表",uploadPath);
|
|
|
}
|
|
|
|
|
|
private String bigToString (BigDecimal o){
|
|
|
@@ -1239,7 +1209,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
|
|
|
|
|
|
|
|
|
|
|
|
- public void sendEmail(String dunId,AdminListBo a,TOrderNewBo b){
|
|
|
+ public void
|
|
|
+ sendEmail(String dunId,AdminListBo a,TOrderNewBo b){
|
|
|
LoggerUtils.debug(logger, "======================邮件信息发送===================");
|
|
|
String content = "<div>客户名称: "+ b.getUserName() +"</div><div>订单编号: " + b.getOrderNo() + "</div><div>合同编号: " + b.getContractNo() + "</div>";
|
|
|
String tite="订单驳回";
|