Ver código fonte

update

Signed-off-by: anderx <312518615@qq.com>
anderx 5 anos atrás
pai
commit
bb2d5cf739
27 arquivos alterados com 5100 adições e 4952 exclusões
  1. 89 92
      src/main/java/com/goafanti/admin/service/AdminService.java
  2. 397 401
      src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java
  3. 29 0
      src/main/java/com/goafanti/common/bo/userDaysBo.java
  4. 3 0
      src/main/java/com/goafanti/common/dao/OfficialFeePriceMapper.java
  5. 1 1
      src/main/java/com/goafanti/common/dao/TOrderPaymentMapper.java
  6. 119 116
      src/main/java/com/goafanti/common/dao/UserLockReleaseMapper.java
  7. 1 0
      src/main/java/com/goafanti/common/enums/NoticeStatus.java
  8. 7 0
      src/main/java/com/goafanti/common/mapper/OfficialFeePriceMapper.xml
  9. 5 3
      src/main/java/com/goafanti/common/mapper/TOrderOutsourceMapper.xml
  10. 3 11
      src/main/java/com/goafanti/common/mapper/TOrderPaymentMapper.xml
  11. 446 430
      src/main/java/com/goafanti/common/mapper/UserLockReleaseMapper.xml
  12. 185 176
      src/main/java/com/goafanti/common/model/Notice.java
  13. 0 3
      src/main/java/com/goafanti/common/model/PaymentNode.java
  14. 812 813
      src/main/java/com/goafanti/common/model/TArrearsDunExample.java
  15. 0 3
      src/main/java/com/goafanti/common/model/ThirdPartyCompany.java
  16. 372 366
      src/main/java/com/goafanti/common/task/OrderDunTask.java
  17. 161 114
      src/main/java/com/goafanti/common/task/ReleaseUserTask.java
  18. 160 161
      src/main/java/com/goafanti/common/utils/SendEmailUtil.java
  19. 519 517
      src/main/java/com/goafanti/customer/service/CustomerService.java
  20. 1609 1598
      src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java
  21. 39 40
      src/main/java/com/goafanti/order/bo/TChangeTaskOut.java
  22. 79 81
      src/main/java/com/goafanti/order/service/impl/NewOrderDunServiceImpl.java
  23. 0 1
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java
  24. 26 22
      src/main/java/com/goafanti/organization/bo/outOrderPayment.java
  25. 34 3
      src/main/java/com/goafanti/organization/service/impl/ThirdPartyCompanyServiceImpl.java
  26. 2 0
      src/main/resources/props/config_local.properties
  27. 2 0
      src/main/resources/props/config_test.properties

+ 89 - 92
src/main/java/com/goafanti/admin/service/AdminService.java

@@ -1,92 +1,89 @@
-package com.goafanti.admin.service;
-
-import java.util.List;
-import java.util.Map;
-
-import com.goafanti.admin.bo.AdminCustomerBo;
-import com.goafanti.admin.bo.AdminCustomerDetailBo;
-import com.goafanti.admin.bo.AdminDetail;
-import com.goafanti.admin.bo.AdminListBo;
-import com.goafanti.common.bo.AreaBo;
-import com.goafanti.common.bo.CityBo;
-import com.goafanti.common.bo.ProvinceBo;
-import com.goafanti.common.model.Admin;
-import com.goafanti.core.mybatis.page.Pagination;
-
-public interface AdminService {
-
-	List<Admin> selectAllAdmin();
-
-	Admin selectByMobile(String username);
-
-	Admin selectByPrimaryKey(String key);
-
-	Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name, String roleName, Integer pNo,
-			Integer pSize);
-
-	int insert(Admin ad);
-
-	int updateByPrimaryKeySelective(Admin ad, List<String> roleIds);
-
-	int updateByPrimaryKey(Admin a);
-
-	AdminDetail selectAdminDetail(String id);
-
-	List<Admin> selectCognizanceConsultant();
-
-	List<Admin> selectPatentAuthor();
-
-	List<Admin> selectPatentPrincipal();
-
-	List<Admin> selectCopyrightConsultant();
-
-	List<Admin> selectCognizancePrincipal();
-
-	List<Admin> selectCopyrightPrincipal();
-
-	List<Admin> selectTechprojectConsultant();
-
-	List<Admin> selectTechprojectPrincipal();
-
-	List<String> selectRoleByPrimaryKey(String aid);
-
-	List<String> listAuditor();
-
-	Map<String, String> selectAccoutManager();
-
-	Map<String, String> selectTechnician();
-
-	Map<String, String> selectSalesman();
-
-	Map<String, String> selectContractManager();
-
-	Map<String, String> selectTechBroder();
-
-	int insertNewAdmin(Admin ad);
-
-	Map<String, String> listAdminSelect();
-
-	List<Admin> listAdminByName(String name);
-
-	List<AdminListBo> selectDepartmentStaff(String departmentId,String name);
-
-	int updateLockAdmin();
-
-	List<Admin> getListDefaultPassword(String id);
-
-	List<Admin> getAdminRoleList(String roleName);
-
-	int addFrequentContacts(String id);
-
-	Pagination<AdminListBo>  frequentContactsList(String depId, String name, String roleName, Integer pageSize, Integer pageNo);
-
-	int deleteFrequentContacts(String id);
-
-	Pagination<AdminCustomerBo> selectAdminCustomerStatistics(String depId, String startTime, String endTime, Integer pageSize, Integer pageNo);
-
-	Pagination<AdminCustomerDetailBo> selectAdminCustomerList(String aid, String startTime, String endTime,Integer type, Integer pageSize, Integer pageNo);
-
-	int updatePrivateBusinessTransfer(String inputId, String uid, String pid);
-
-
-}
+package com.goafanti.admin.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.goafanti.admin.bo.AdminCustomerBo;
+import com.goafanti.admin.bo.AdminCustomerDetailBo;
+import com.goafanti.admin.bo.AdminDetail;
+import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.common.model.Admin;
+import com.goafanti.core.mybatis.page.Pagination;
+
+public interface AdminService {
+
+	List<Admin> selectAllAdmin();
+
+	Admin selectByMobile(String username);
+
+	Admin selectByPrimaryKey(String key);
+
+	Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name, String roleName, Integer pNo,
+			Integer pSize);
+
+	int insert(Admin ad);
+
+	int updateByPrimaryKeySelective(Admin ad, List<String> roleIds);
+
+	int updateByPrimaryKey(Admin a);
+
+	AdminDetail selectAdminDetail(String id);
+
+	List<Admin> selectCognizanceConsultant();
+
+	List<Admin> selectPatentAuthor();
+
+	List<Admin> selectPatentPrincipal();
+
+	List<Admin> selectCopyrightConsultant();
+
+	List<Admin> selectCognizancePrincipal();
+
+	List<Admin> selectCopyrightPrincipal();
+
+	List<Admin> selectTechprojectConsultant();
+
+	List<Admin> selectTechprojectPrincipal();
+
+	List<String> selectRoleByPrimaryKey(String aid);
+
+	List<String> listAuditor();
+
+	Map<String, String> selectAccoutManager();
+
+	Map<String, String> selectTechnician();
+
+	Map<String, String> selectSalesman();
+
+	Map<String, String> selectContractManager();
+
+	Map<String, String> selectTechBroder();
+
+	int insertNewAdmin(Admin ad);
+
+	Map<String, String> listAdminSelect();
+
+	List<Admin> listAdminByName(String name);
+
+	List<AdminListBo> selectDepartmentStaff(String departmentId,String name);
+
+	int updateLockAdmin();
+
+	List<Admin> getListDefaultPassword(String id);
+
+	List<Admin> getAdminRoleList(String roleName);
+
+	int addFrequentContacts(String id);
+
+	Pagination<AdminListBo>  frequentContactsList(String depId, String name, String roleName, Integer pageSize, Integer pageNo);
+
+	int deleteFrequentContacts(String id);
+
+	Pagination<AdminCustomerBo> selectAdminCustomerStatistics(String depId, String startTime, String endTime, Integer pageSize, Integer pageNo);
+
+	Pagination<AdminCustomerDetailBo> selectAdminCustomerList(String aid, String startTime, String endTime,Integer type, Integer pageSize, Integer pageNo);
+
+	int updatePrivateBusinessTransfer(String inputId, String uid, String pid);
+
+
+}

+ 397 - 401
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -1,401 +1,397 @@
-package com.goafanti.admin.service.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.goafanti.admin.bo.AdminContacts;
-import com.goafanti.admin.bo.AdminCustomerBo;
-import com.goafanti.admin.bo.AdminCustomerDetailBo;
-import com.goafanti.admin.bo.AdminDetail;
-import com.goafanti.admin.bo.AdminListBo;
-import com.goafanti.admin.service.AdminService;
-import com.goafanti.common.bo.AreaBo;
-import com.goafanti.common.bo.CityBo;
-import com.goafanti.common.bo.ProvinceBo;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.AdminLocationMapper;
-import com.goafanti.common.dao.AdminMapper;
-import com.goafanti.common.dao.DistrictGlossoryMapper;
-import com.goafanti.common.dao.UserBusinessMapper;
-import com.goafanti.common.dao.UserLockReleaseMapper;
-import com.goafanti.common.dao.UserRoleMapper;
-import com.goafanti.common.model.Admin;
-import com.goafanti.common.model.UserBusiness;
-import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.common.utils.PasswordUtil;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.core.mybatis.BaseMybatisDao;
-import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.customer.bo.BusinessListBo;
-
-@Service
-public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements AdminService {
-	@Autowired
-	private AdminMapper			adminMapper;
-	@Autowired
-	private UserRoleMapper		userRoleMapper;
-	@Autowired
-	private AdminLocationMapper	adminLocationMapper;
-	@Autowired
-	private UserLockReleaseMapper	userLockReleaseMapper;
-	@Autowired
-	private UserBusinessMapper	userBusinessMapper;
-	@Resource(name = "passwordUtil")
-	private PasswordUtil					passwordUtil;
-	
-	@Override
-	public List<Admin> selectAllAdmin() {
-		return adminMapper.selectAllAdmin(null);
-	}
-
-	@Override
-	public Admin selectByMobile(String mobile) {
-		return adminMapper.selectByMobile(mobile);
-	}
-
-	@Override
-	public Admin selectByPrimaryKey(String key) {
-		return adminMapper.selectByPrimaryKey(key);
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name,String roleName,
-			Integer pageNo, Integer pageSize) {
-		Map<String, Object> params = new HashMap<>();
-		if (StringUtils.isNotBlank(roleName))params.put("roleName", roleName);
-		if (StringUtils.isNotBlank(mobile))params.put("mobile", mobile);
-		if (StringUtils.isNotBlank(name))params.put("name", name);
-		if (null != number)params.put("number", number);
-		if (pageNo == null || pageNo < 0)pageNo = 1;
-		if (pageSize == null || pageSize < 0 || pageSize > 10)pageSize = 10;
-		if (province != null) params.put("province", province);
-		return (Pagination<AdminListBo>) findPage("findAdminListByPage", "findAdminCount", params, pageNo,
-					pageSize);
-	}
-
-	@Override
-	public int insert(Admin ad) {
-		return adminMapper.insert(ad);
-	}
-
-	@Override
-	public int updateByPrimaryKeySelective(Admin ad, List<String> roleIds) {
-		Map<String, Object> params = new HashMap<>();
-		params.put("uid", ad.getId());
-		params.put("roles", roleIds);
-
-		if (ad.getId() != "1") {
-			userRoleMapper.deleteByUserId(ad.getId());
-			if (!roleIds.isEmpty()) {
-				userRoleMapper.insertBatch(params);
-			}
-			TokenManager.clearUserAuthByUserId(ad.getId());
-		}
-		return adminMapper.updateByPrimaryKeySelective(ad);
-	}
-
-	@Override
-	public int updateByPrimaryKey(Admin a) {
-		return adminMapper.updateByPrimaryKeySelective(a);
-	}
-
-	@Override
-	public AdminDetail selectAdminDetail(String id) {
-		Admin a = adminMapper.selectByPrimaryKey(id);
-		if (null == a) {
-			return null;
-		}
-
-		AdminDetail ad = new AdminDetail();
-		BeanUtils.copyProperties(a, ad);
-		ad.setRoles(adminMapper.selectRolesByPrimaryKey(id));
-		return null;
-	}
-
-	@Override
-	public List<Admin> selectCognizanceConsultant() {
-		return adminMapper.selectCognizanceConsultant();
-	}
-
-	@Override
-	public List<Admin> selectPatentAuthor() {
-		return adminMapper.selectPatentAuthor();
-	}
-
-	@Override
-	public List<Admin> selectPatentPrincipal() {
-		return adminMapper.selectPatentPrincipal();
-	}
-
-	@Override
-	public List<Admin> selectCopyrightConsultant() {
-		return adminMapper.selectCopyrightConsultant();
-	}
-
-	@Override
-	public List<Admin> selectCognizancePrincipal() {
-		return adminMapper.selectCognizancePrincipal();
-	}
-
-	@Override
-	public List<Admin> selectCopyrightPrincipal() {
-		return adminMapper.selectCopyrightPrincipal();
-	}
-
-	@Override
-	public List<Admin> selectTechprojectConsultant() {
-		return adminMapper.selectTechprojectConsultant();
-	}
-
-	@Override
-	public List<Admin> selectTechprojectPrincipal() {
-		return adminMapper.selectTechprojectPrincipal();
-	}
-
-	@Override
-	public List<String> selectRoleByPrimaryKey(String uid) {
-		return adminMapper.selectRoleByPrimaryKey(uid);
-	}
-
-	@Override
-	public List<String> listAuditor() {
-		return userRoleMapper.listAuditor();
-	}
-
-	@Override
-	public Map<String, String> selectAccoutManager() {
-		return disposeAdminList(adminMapper.selectAccoutManager());
-	}
-
-	@Override
-	public Map<String, String> selectTechnician() {
-		return disposeAdminList(adminMapper.selectTechnician());
-	}
-
-	@Override
-	public Map<String, String> selectSalesman() {
-		return disposeAdminList(adminMapper.selectSalesman());
-	}
-
-	@Override
-	public Map<String, String> selectContractManager() {
-		return disposeAdminList(adminMapper.selectContractManager());
-	}
-
-	@Override
-	public Map<String, String> selectTechBroder() {
-		return disposeAdminList(adminMapper.selectTechBroder());
-	}
-
-	@Override
-	public int insertNewAdmin(Admin ad) {
-		return adminMapper.insert(ad);
-	}
-
-	@Override
-	public Map<String, String> listAdminSelect() {
-		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
-			return disposeAdminList(adminMapper.listAdminSelectBySuperAdmin());
-		} else if (TokenManager.hasRole(AFTConstants.AREAADMIN)) {
-			List<Integer> provinceList = adminLocationMapper
-					.selectProvinceWhereCityIsNullByAdminId(TokenManager.getAdminId());
-			List<Integer> cityList = adminLocationMapper.selectCityByAdminId(TokenManager.getAdminId());
-			provinceList.addAll(cityList);
-			return disposeAdminList(adminMapper.listAdminSelectByAreaAdmin(provinceList, cityList));
-		}
-		return null;
-	}
-
-	private Map<String, String> disposeAdminList(List<Admin> list) {
-		Map<String, String> map = new TreeMap<String, String>();
-		for (Admin o : list) {
-			map.put(o.getId(), o.getName());
-		}
-		return map;
-	}
-
-	@Override
-	public List<Admin> listAdminByName(String name) {
-		
-		return adminMapper.listAdminByName(name);
-	}
-
-	@Override
-	public List<AdminListBo> selectDepartmentStaff(String departmentId, String name) {
-		
-		return adminMapper.selectDepartmentStaff( departmentId,  name);
-	}
-
-	@Override
-	public int updateLockAdmin() {
-		int count=0;
-		List<Admin> list=adminMapper.selectAllAdmin(null);//获取所有用户
-		List<List<Admin>>aList=groupList(list);//拆分成多个
-		String lockIds = "";
-		for(List<Admin> al:aList){
-			for (Admin a : al) {
-				String pwd=a.getPassword();
-				a.setPassword("123456");
-				String pwd2=passwordUtil.getEncryptPwd(a);
-				if (pwd.equals(pwd2)) {
-					lockIds += a.getId() + ",";
-				}
-			}
-			if(lockIds.length()>0){
-				try {
-				lockIds = "'" + lockIds.substring(0,lockIds.length()-1).replace(",", "','") + "'";
-				count+= adminMapper.updateLockIds(lockIds);
-				lockIds = "";
-					Thread.sleep(1000);
-				} catch (InterruptedException e) {
-					LoggerUtils.error(getClass(), "未修改管理员锁定失败", e);
-				}
-			}
-		}
-		return count;
-	}
-	
-	  /*
-     * List分割
-     */
-    public  List<List<Admin>> groupList(List<Admin> list) {
-        List<List<Admin>> listGroup = new ArrayList<List<Admin>>();
-        int listSize = list.size();
-        //子集合的长度
-        int toIndex = 100;
-        for (int i = 0; i < list.size(); i += toIndex) {
-            if (i + toIndex > listSize) {
-                toIndex = listSize - i;
-            }
-            List<Admin> newList = list.subList(i, i + toIndex);
-            listGroup.add(newList);
-        }
-        return listGroup;
-    }
-  
-
-	@Override
-	public List<Admin> getListDefaultPassword(String depId) {
-		List<Admin> list=adminMapper.selectAllAdmin(depId);
-		List<Admin> list2=new ArrayList<>();
-		for (Admin a : list) {
-			String pwd=a.getPassword();
-			a.setPassword("123456");
-			String pwd2=passwordUtil.getEncryptPwd(a);
-			if (pwd.equals(pwd2)) {
-				list2.add(a);
-			}
-		}
-		return list2;
-	}
-
-	@Override
-	public List<Admin> getAdminRoleList(String roleName) {
-		return adminMapper.getAdminRoleList(roleName);
-	}
-
-	@Override
-	public int addFrequentContacts(String id) {
-		String []ss=id.split(",");
-		List<String> list=adminMapper.getaidFrequentContacts(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
-		for (String s : ss) {
-			boolean flag=true;
-			for (String s2 : list) {
-				if (s.equals(s2)) {
-					flag=false;
-				}
-			}
-			if (flag) {
-				AdminContacts a=new AdminContacts();
-				a.setId(UUID.randomUUID().toString());
-				a.setAid(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
-				a.setContactsId(s);
-				adminMapper.addAdminContacts(a);
-			}
-		}
-		return 1;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public Pagination<AdminListBo> frequentContactsList(String depId, String name,String roleName, Integer pageSize, Integer pageNo) {
-		Map<String, Object> params = new HashMap<String, Object>();
-		if(pageSize==null||pageSize<0)pageSize=10;
-		if(pageNo==null||pageNo<0)pageNo=1;
-		if (StringUtils.isNotBlank(depId)) params.put("depId", depId);
-		if (StringUtils.isNotBlank(name)) params.put("name", name);
-		if (StringUtils.isNotBlank(roleName)) params.put("roleName", roleName);
-		params.put("aid", TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
-		Pagination<AdminListBo> p = (Pagination<AdminListBo>)findPage("frequentContactsList", "frequentContactsCount", params, pageNo, pageSize);
-		List<AdminListBo> list=(List<AdminListBo>)p.getList();
-		for(AdminListBo i:list){
-			i.setRoles(adminMapper.selectRolesByUid(i.getContactId()));
-		}
-		return p;
-	}
-
-	@Override
-	public int deleteFrequentContacts(String id) {
-		return adminMapper.deleteFrequentContacts(id);
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public Pagination<AdminCustomerBo> selectAdminCustomerStatistics(String depId, String startTime, String endTime, Integer pageSize, Integer pageNo) {
-		Map<String, Object> params = new HashMap<String, Object>();
-		if(pageSize==null||pageSize<0)pageSize=10;
-		if(pageNo==null||pageNo<0)pageNo=1;
-		if (StringUtils.isNotBlank(depId)) params.put("depId", depId);
-		if (StringUtils.isNotBlank(startTime)) params.put("startTime", startTime);
-		if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
-		return (Pagination<AdminCustomerBo>)findPage("selectAdminCustomerList", "selectAdminCustomerCount", params, pageNo, pageSize); 
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public Pagination<AdminCustomerDetailBo> selectAdminCustomerList(String aid, String startTime, String endTime,Integer type,
-			Integer pageSize, Integer pageNo) {
-		Map<String, Object> params = new HashMap<String, Object>();
-		if(pageSize==null||pageSize<0)pageSize=10;
-		if(pageNo==null||pageNo<0)pageNo=1;
-		if (StringUtils.isNotBlank(aid)) params.put("aid", aid);
-		if (type!=null) params.put("type", type);
-		if (StringUtils.isNotBlank(startTime)) params.put("startTime", startTime);
-		if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
-		return (Pagination<AdminCustomerDetailBo>)findPage("selectAdminCustomerDetailList", "selectAdminCustomerDetailCount", params, pageNo, pageSize);
-	}
-
-	@Override
-	public int updatePrivateBusinessTransfer(String inputId, String uid, String pid) {
-		String aid=TokenManager.getAdminId();
-		int i=userLockReleaseMapper.updatePrivateBusinessTransfer( inputId,  uid,  pid,aid);
-		if (i>0) {
-			List<BusinessListBo> l=userBusinessMapper.selectBusinessProjectByUAPid(uid, inputId, pid);
-			if (l.isEmpty()) {
-				UserBusiness ub=new UserBusiness();
-				ub.setId(UUID.randomUUID().toString());
-				ub.setAid(inputId);
-				ub.setUid(uid);
-				ub.setBusinessProjectId(pid);
-				ub.setCustomerStatus(4);
-				ub.setFollowSituation(5);
-				ub.setRemarks("转交客户业务触发");
-				userBusinessMapper.insertSelective(ub);
-			}
-		}
-		return i;
-	}
-	
-}
+package com.goafanti.admin.service.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.admin.bo.AdminContacts;
+import com.goafanti.admin.bo.AdminCustomerBo;
+import com.goafanti.admin.bo.AdminCustomerDetailBo;
+import com.goafanti.admin.bo.AdminDetail;
+import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.admin.service.AdminService;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.AdminLocationMapper;
+import com.goafanti.common.dao.AdminMapper;
+import com.goafanti.common.dao.UserBusinessMapper;
+import com.goafanti.common.dao.UserLockReleaseMapper;
+import com.goafanti.common.dao.UserRoleMapper;
+import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.UserBusiness;
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.common.utils.PasswordUtil;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.customer.bo.BusinessListBo;
+
+@Service
+public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements AdminService {
+	@Autowired
+	private AdminMapper			adminMapper;
+	@Autowired
+	private UserRoleMapper		userRoleMapper;
+	@Autowired
+	private AdminLocationMapper	adminLocationMapper;
+	@Autowired
+	private UserLockReleaseMapper	userLockReleaseMapper;
+	@Autowired
+	private UserBusinessMapper	userBusinessMapper;
+	@Resource(name = "passwordUtil")
+	private PasswordUtil					passwordUtil;
+	
+	@Override
+	public List<Admin> selectAllAdmin() {
+		return adminMapper.selectAllAdmin(null);
+	}
+
+	@Override
+	public Admin selectByMobile(String mobile) {
+		return adminMapper.selectByMobile(mobile);
+	}
+
+	@Override
+	public Admin selectByPrimaryKey(String key) {
+		return adminMapper.selectByPrimaryKey(key);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name,String roleName,
+			Integer pageNo, Integer pageSize) {
+		Map<String, Object> params = new HashMap<>();
+		if (StringUtils.isNotBlank(roleName))params.put("roleName", roleName);
+		if (StringUtils.isNotBlank(mobile))params.put("mobile", mobile);
+		if (StringUtils.isNotBlank(name))params.put("name", name);
+		if (null != number)params.put("number", number);
+		if (pageNo == null || pageNo < 0)pageNo = 1;
+		if (pageSize == null || pageSize < 0 || pageSize > 10)pageSize = 10;
+		if (province != null) params.put("province", province);
+		return (Pagination<AdminListBo>) findPage("findAdminListByPage", "findAdminCount", params, pageNo,
+					pageSize);
+	}
+
+	@Override
+	public int insert(Admin ad) {
+		return adminMapper.insert(ad);
+	}
+
+	@Override
+	public int updateByPrimaryKeySelective(Admin ad, List<String> roleIds) {
+		Map<String, Object> params = new HashMap<>();
+		params.put("uid", ad.getId());
+		params.put("roles", roleIds);
+
+		if (ad.getId() != "1") {
+			userRoleMapper.deleteByUserId(ad.getId());
+			if (!roleIds.isEmpty()) {
+				userRoleMapper.insertBatch(params);
+			}
+			TokenManager.clearUserAuthByUserId(ad.getId());
+		}
+		return adminMapper.updateByPrimaryKeySelective(ad);
+	}
+
+	@Override
+	public int updateByPrimaryKey(Admin a) {
+		return adminMapper.updateByPrimaryKeySelective(a);
+	}
+
+	@Override
+	public AdminDetail selectAdminDetail(String id) {
+		Admin a = adminMapper.selectByPrimaryKey(id);
+		if (null == a) {
+			return null;
+		}
+
+		AdminDetail ad = new AdminDetail();
+		BeanUtils.copyProperties(a, ad);
+		ad.setRoles(adminMapper.selectRolesByPrimaryKey(id));
+		return null;
+	}
+
+	@Override
+	public List<Admin> selectCognizanceConsultant() {
+		return adminMapper.selectCognizanceConsultant();
+	}
+
+	@Override
+	public List<Admin> selectPatentAuthor() {
+		return adminMapper.selectPatentAuthor();
+	}
+
+	@Override
+	public List<Admin> selectPatentPrincipal() {
+		return adminMapper.selectPatentPrincipal();
+	}
+
+	@Override
+	public List<Admin> selectCopyrightConsultant() {
+		return adminMapper.selectCopyrightConsultant();
+	}
+
+	@Override
+	public List<Admin> selectCognizancePrincipal() {
+		return adminMapper.selectCognizancePrincipal();
+	}
+
+	@Override
+	public List<Admin> selectCopyrightPrincipal() {
+		return adminMapper.selectCopyrightPrincipal();
+	}
+
+	@Override
+	public List<Admin> selectTechprojectConsultant() {
+		return adminMapper.selectTechprojectConsultant();
+	}
+
+	@Override
+	public List<Admin> selectTechprojectPrincipal() {
+		return adminMapper.selectTechprojectPrincipal();
+	}
+
+	@Override
+	public List<String> selectRoleByPrimaryKey(String uid) {
+		return adminMapper.selectRoleByPrimaryKey(uid);
+	}
+
+	@Override
+	public List<String> listAuditor() {
+		return userRoleMapper.listAuditor();
+	}
+
+	@Override
+	public Map<String, String> selectAccoutManager() {
+		return disposeAdminList(adminMapper.selectAccoutManager());
+	}
+
+	@Override
+	public Map<String, String> selectTechnician() {
+		return disposeAdminList(adminMapper.selectTechnician());
+	}
+
+	@Override
+	public Map<String, String> selectSalesman() {
+		return disposeAdminList(adminMapper.selectSalesman());
+	}
+
+	@Override
+	public Map<String, String> selectContractManager() {
+		return disposeAdminList(adminMapper.selectContractManager());
+	}
+
+	@Override
+	public Map<String, String> selectTechBroder() {
+		return disposeAdminList(adminMapper.selectTechBroder());
+	}
+
+	@Override
+	public int insertNewAdmin(Admin ad) {
+		return adminMapper.insert(ad);
+	}
+
+	@Override
+	public Map<String, String> listAdminSelect() {
+		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
+			return disposeAdminList(adminMapper.listAdminSelectBySuperAdmin());
+		} else if (TokenManager.hasRole(AFTConstants.AREAADMIN)) {
+			List<Integer> provinceList = adminLocationMapper
+					.selectProvinceWhereCityIsNullByAdminId(TokenManager.getAdminId());
+			List<Integer> cityList = adminLocationMapper.selectCityByAdminId(TokenManager.getAdminId());
+			provinceList.addAll(cityList);
+			return disposeAdminList(adminMapper.listAdminSelectByAreaAdmin(provinceList, cityList));
+		}
+		return null;
+	}
+
+	private Map<String, String> disposeAdminList(List<Admin> list) {
+		Map<String, String> map = new TreeMap<String, String>();
+		for (Admin o : list) {
+			map.put(o.getId(), o.getName());
+		}
+		return map;
+	}
+
+	@Override
+	public List<Admin> listAdminByName(String name) {
+		
+		return adminMapper.listAdminByName(name);
+	}
+
+	@Override
+	public List<AdminListBo> selectDepartmentStaff(String departmentId, String name) {
+		
+		return adminMapper.selectDepartmentStaff( departmentId,  name);
+	}
+
+	@Override
+	public int updateLockAdmin() {
+		int count=0;
+		List<Admin> list=adminMapper.selectAllAdmin(null);//获取所有用户
+		List<List<Admin>>aList=groupList(list);//拆分成多个
+		String lockIds = "";
+		for(List<Admin> al:aList){
+			for (Admin a : al) {
+				String pwd=a.getPassword();
+				a.setPassword("123456");
+				String pwd2=passwordUtil.getEncryptPwd(a);
+				if (pwd.equals(pwd2)) {
+					lockIds += a.getId() + ",";
+				}
+			}
+			if(lockIds.length()>0){
+				try {
+				lockIds = "'" + lockIds.substring(0,lockIds.length()-1).replace(",", "','") + "'";
+				count+= adminMapper.updateLockIds(lockIds);
+				lockIds = "";
+					Thread.sleep(1000);
+				} catch (InterruptedException e) {
+					LoggerUtils.error(getClass(), "未修改管理员锁定失败", e);
+				}
+			}
+		}
+		return count;
+	}
+	
+	  /*
+     * List分割
+     */
+    public  List<List<Admin>> groupList(List<Admin> list) {
+        List<List<Admin>> listGroup = new ArrayList<List<Admin>>();
+        int listSize = list.size();
+        //子集合的长度
+        int toIndex = 100;
+        for (int i = 0; i < list.size(); i += toIndex) {
+            if (i + toIndex > listSize) {
+                toIndex = listSize - i;
+            }
+            List<Admin> newList = list.subList(i, i + toIndex);
+            listGroup.add(newList);
+        }
+        return listGroup;
+    }
+  
+
+	@Override
+	public List<Admin> getListDefaultPassword(String depId) {
+		List<Admin> list=adminMapper.selectAllAdmin(depId);
+		List<Admin> list2=new ArrayList<>();
+		for (Admin a : list) {
+			String pwd=a.getPassword();
+			a.setPassword("123456");
+			String pwd2=passwordUtil.getEncryptPwd(a);
+			if (pwd.equals(pwd2)) {
+				list2.add(a);
+			}
+		}
+		return list2;
+	}
+
+	@Override
+	public List<Admin> getAdminRoleList(String roleName) {
+		return adminMapper.getAdminRoleList(roleName);
+	}
+
+	@Override
+	public int addFrequentContacts(String id) {
+		String []ss=id.split(",");
+		List<String> list=adminMapper.getaidFrequentContacts(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
+		for (String s : ss) {
+			boolean flag=true;
+			for (String s2 : list) {
+				if (s.equals(s2)) {
+					flag=false;
+				}
+			}
+			if (flag) {
+				AdminContacts a=new AdminContacts();
+				a.setId(UUID.randomUUID().toString());
+				a.setAid(TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
+				a.setContactsId(s);
+				adminMapper.addAdminContacts(a);
+			}
+		}
+		return 1;
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AdminListBo> frequentContactsList(String depId, String name,String roleName, Integer pageSize, Integer pageNo) {
+		Map<String, Object> params = new HashMap<String, Object>();
+		if(pageSize==null||pageSize<0)pageSize=10;
+		if(pageNo==null||pageNo<0)pageNo=1;
+		if (StringUtils.isNotBlank(depId)) params.put("depId", depId);
+		if (StringUtils.isNotBlank(name)) params.put("name", name);
+		if (StringUtils.isNotBlank(roleName)) params.put("roleName", roleName);
+		params.put("aid", TokenManager.getAdminId()==null?"1":TokenManager.getAdminId());
+		Pagination<AdminListBo> p = (Pagination<AdminListBo>)findPage("frequentContactsList", "frequentContactsCount", params, pageNo, pageSize);
+		List<AdminListBo> list=(List<AdminListBo>)p.getList();
+		for(AdminListBo i:list){
+			i.setRoles(adminMapper.selectRolesByUid(i.getContactId()));
+		}
+		return p;
+	}
+
+	@Override
+	public int deleteFrequentContacts(String id) {
+		return adminMapper.deleteFrequentContacts(id);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AdminCustomerBo> selectAdminCustomerStatistics(String depId, String startTime, String endTime, Integer pageSize, Integer pageNo) {
+		Map<String, Object> params = new HashMap<String, Object>();
+		if(pageSize==null||pageSize<0)pageSize=10;
+		if(pageNo==null||pageNo<0)pageNo=1;
+		if (StringUtils.isNotBlank(depId)) params.put("depId", depId);
+		if (StringUtils.isNotBlank(startTime)) params.put("startTime", startTime);
+		if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
+		return (Pagination<AdminCustomerBo>)findPage("selectAdminCustomerList", "selectAdminCustomerCount", params, pageNo, pageSize); 
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<AdminCustomerDetailBo> selectAdminCustomerList(String aid, String startTime, String endTime,Integer type,
+			Integer pageSize, Integer pageNo) {
+		Map<String, Object> params = new HashMap<String, Object>();
+		if(pageSize==null||pageSize<0)pageSize=10;
+		if(pageNo==null||pageNo<0)pageNo=1;
+		if (StringUtils.isNotBlank(aid)) params.put("aid", aid);
+		if (type!=null) params.put("type", type);
+		if (StringUtils.isNotBlank(startTime)) params.put("startTime", startTime);
+		if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
+		return (Pagination<AdminCustomerDetailBo>)findPage("selectAdminCustomerDetailList", "selectAdminCustomerDetailCount", params, pageNo, pageSize);
+	}
+
+	@Override
+	public int updatePrivateBusinessTransfer(String inputId, String uid, String pid) {
+		String aid=TokenManager.getAdminId();
+		int i=userLockReleaseMapper.updatePrivateBusinessTransfer( inputId,  uid,  pid,aid);
+		if (i>0) {
+			List<BusinessListBo> l=userBusinessMapper.selectBusinessProjectByUAPid(uid, inputId, pid);
+			if (l.isEmpty()) {
+				UserBusiness ub=new UserBusiness();
+				ub.setId(UUID.randomUUID().toString());
+				ub.setAid(inputId);
+				ub.setUid(uid);
+				ub.setBusinessProjectId(pid);
+				ub.setCustomerStatus(4);
+				ub.setFollowSituation(5);
+				ub.setRemarks("转交客户业务触发");
+				userBusinessMapper.insertSelective(ub);
+			}
+		}
+		return i;
+	}
+	
+}

+ 29 - 0
src/main/java/com/goafanti/common/bo/userDaysBo.java

@@ -0,0 +1,29 @@
+package com.goafanti.common.bo;
+
+public class userDaysBo {
+	
+	private String uid;
+	private String aid;
+	private String name;
+	public String getUid() {
+		return uid;
+	}
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+	public String getAid() {
+		return aid;
+	}
+	public void setAid(String aid) {
+		this.aid = aid;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	
+
+}

+ 3 - 0
src/main/java/com/goafanti/common/dao/OfficialFeePriceMapper.java

@@ -74,4 +74,7 @@ public interface OfficialFeePriceMapper {
 	int updateByPrimaryKey(OfficialFeePrice record);
 
 	List<OfficialFeePrice> selectListByname(@Param("name")String name);
+
+
+	OfficialFeePrice selectBytype(Integer type);
 }

+ 1 - 1
src/main/java/com/goafanti/common/dao/TOrderPaymentMapper.java

@@ -75,7 +75,7 @@ public interface TOrderPaymentMapper {
 	 */
 	int updateByPrimaryKey(TOrderPayment record);
 
-	outOrderPayment selectByidGetDetails(@Param("id")Integer id, @Param("type")int type);
+	outOrderPayment selectByidGetDetails(@Param("id")Integer id);
 
 	int insertSelectiveGetId(TOrderPayment p);
 

+ 119 - 116
src/main/java/com/goafanti/common/dao/UserLockReleaseMapper.java

@@ -1,117 +1,120 @@
-package com.goafanti.common.dao;
-
-import com.goafanti.common.model.UserLockRelease;
-import com.goafanti.common.model.UserLockReleaseExample;
-import com.goafanti.customer.bo.LockingReleaseBo;
-
-import java.util.Date;
-import java.util.List;
-import org.apache.ibatis.annotations.Param;
-
-public interface UserLockReleaseMapper {
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	long countByExample(UserLockReleaseExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	int deleteByExample(UserLockReleaseExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	int deleteByPrimaryKey(String id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	int insert(UserLockRelease record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	int insertSelective(UserLockRelease record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	List<UserLockRelease> selectByExample(UserLockReleaseExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	UserLockRelease selectByPrimaryKey(String id);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	int updateByExampleSelective(@Param("record") UserLockRelease record,
-			@Param("example") UserLockReleaseExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	int updateByExample(@Param("record") UserLockRelease record, @Param("example") UserLockReleaseExample example);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	int updateByPrimaryKeySelective(UserLockRelease record);
-
-	/**
-	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
-	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
-	 */
-	int updateByPrimaryKey(UserLockRelease record);
-
-	int deleteLockByOrder(@Param("orderNo")String orderNo,@Param("businessProjectId") String businessProjectId);
-
-	/**
-	 * 重新锁定
-	 * @param oldAid
-	 * @param aid
-	 * @param uid
-	 * @return
-	 */
-	int updateUserLock(@Param("uid")String uid,@Param("aid")String aid,@Param("oldStatus")Integer oldStatus,@Param("newStatus")Integer newStatus);
-	
-	int updateUserTypeLock(@Param("uid")String uid,@Param("aid")String aid,@Param("type")Integer type,
-			@Param("newStatus")Integer newStatus,@Param("date") Date date);
-
-	List<LockingReleaseBo> selectWaitReleaseCustomer(String aid);
-
-	List<LockingReleaseBo> selectWaitReleaseBusiness(String aid);
-
-	void updateReleaseLock(@Param("time")String time);
-
-	void updatePendingReleaseLock(@Param("lockIds")String lockIds);
-
-	List<LockingReleaseBo> selectPendinglockUserList();
-
-	void updateProject(@Param("uid")String uid, @Param("aid")String aid, @Param("businessProjectId")String businessProjectId);
-
-	List<LockingReleaseBo> checkTask(@Param("buyerId")String buyerId, @Param("commodityId")String commodityId);
-
-
-	void updateBatchReleaseProject(@Param("uids")List<String> uids, @Param("receiveId")String receiveId, @Param("aid")String aid);
-
-	void updateBatchlockProject(@Param("uid")List<String> uids, @Param("receiveId")String receiveId, @Param("aid")String aid);
-
-	int updatePrivateBusinessTransfer(@Param("inputId")String inputId, @Param("uid")String uid, @Param("pid")String pid,@Param("aid")String aid);
-
-	List<LockingReleaseBo> checkUserProject(@Param("uid")String uid, @Param("pid")String pid, @Param("aid")String aid);
-
+package com.goafanti.common.dao;
+
+import com.goafanti.common.bo.userDaysBo;
+import com.goafanti.common.model.UserLockRelease;
+import com.goafanti.common.model.UserLockReleaseExample;
+import com.goafanti.customer.bo.LockingReleaseBo;
+
+import java.util.Date;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface UserLockReleaseMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	long countByExample(UserLockReleaseExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	int deleteByExample(UserLockReleaseExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	int deleteByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	int insert(UserLockRelease record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	int insertSelective(UserLockRelease record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	List<UserLockRelease> selectByExample(UserLockReleaseExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	UserLockRelease selectByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	int updateByExampleSelective(@Param("record") UserLockRelease record,
+			@Param("example") UserLockReleaseExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	int updateByExample(@Param("record") UserLockRelease record, @Param("example") UserLockReleaseExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	int updateByPrimaryKeySelective(UserLockRelease record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table user_lock_release
+	 * @mbg.generated  Mon May 07 09:56:32 CST 2018
+	 */
+	int updateByPrimaryKey(UserLockRelease record);
+
+	int deleteLockByOrder(@Param("orderNo")String orderNo,@Param("businessProjectId") String businessProjectId);
+
+	/**
+	 * 重新锁定
+	 * @param oldAid
+	 * @param aid
+	 * @param uid
+	 * @return
+	 */
+	int updateUserLock(@Param("uid")String uid,@Param("aid")String aid,@Param("oldStatus")Integer oldStatus,@Param("newStatus")Integer newStatus);
+	
+	int updateUserTypeLock(@Param("uid")String uid,@Param("aid")String aid,@Param("type")Integer type,
+			@Param("newStatus")Integer newStatus,@Param("date") Date date);
+
+	List<LockingReleaseBo> selectWaitReleaseCustomer(String aid);
+
+	List<LockingReleaseBo> selectWaitReleaseBusiness(String aid);
+
+	void updateReleaseLock(@Param("time")String time);
+
+	void updatePendingReleaseLock(@Param("lockIds")String lockIds);
+
+	List<LockingReleaseBo> selectPendinglockUserList();
+
+	void updateProject(@Param("uid")String uid, @Param("aid")String aid, @Param("businessProjectId")String businessProjectId);
+
+	List<LockingReleaseBo> checkTask(@Param("buyerId")String buyerId, @Param("commodityId")String commodityId);
+
+
+	void updateBatchReleaseProject(@Param("uids")List<String> uids, @Param("receiveId")String receiveId, @Param("aid")String aid);
+
+	void updateBatchlockProject(@Param("uid")List<String> uids, @Param("receiveId")String receiveId, @Param("aid")String aid);
+
+	int updatePrivateBusinessTransfer(@Param("inputId")String inputId, @Param("uid")String uid, @Param("pid")String pid,@Param("aid")String aid);
+
+	List<LockingReleaseBo> checkUserProject(@Param("uid")String uid, @Param("pid")String pid, @Param("aid")String aid);
+
+	List<userDaysBo> selectUserDays(@Param("aid")String aid, @Param("x")Integer x, @Param("y")Integer y);
+
 }

+ 1 - 0
src/main/java/com/goafanti/common/enums/NoticeStatus.java

@@ -54,6 +54,7 @@ public enum NoticeStatus {
 	PAYMENT_NO(45,"付款驳回通知"),
 	PAYMENT_YES(46,"付款通过通知"),
 	PAYMENT_COMPLETE(47,"财务付款通知"),
+	CUSTOMER_PRIVATE_REMINDER(48,"客户私有提醒"),
 	OTHER(0, "其他");
 
 	private NoticeStatus(Integer code, String desc) {

+ 7 - 0
src/main/java/com/goafanti/common/mapper/OfficialFeePriceMapper.xml

@@ -305,4 +305,11 @@
   select id,type,amount,proportion85,remarks,date_format(create_time, '%Y-%m-%d %H:%i:%S') createTimes
 	 from official_fee_price where 1=1
   </select>
+    <select id="selectBytype" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    
+    select 
+    <include refid="Base_Column_List" />
+    from official_fee_price
+    where type = #{cid,jdbcType=INTEGER}
+  </select>
 </mapper>

+ 5 - 3
src/main/java/com/goafanti/common/mapper/TOrderOutsourceMapper.xml

@@ -506,9 +506,11 @@
     where id = #{id,jdbcType=INTEGER}
   </update>
   <select id="selectByOrderNo" resultType="com.goafanti.order.bo.OrderOutsourceDtails">
-     select id, order_no orderNo, refund_status refundStatus, date_format(create_time,'%Y-%m-%d %H:%i:%S') createTimes , remarks,
-	 date_format(audit_time,'%Y-%m-%d %H:%i:%S') auditTimes,attachment_url attachmentUrl, picture_url pictureUrl, amount,start_type startType,
-	 company_name companyName ,unit_price unitPrice,unit_number unitNumber,outsource_remarks outsourceRemarks from t_order_outsource
+     	select id, order_no orderNo, refund_status refundStatus, date_format(create_time,'%Y-%m-%d %H:%i:%S') createTimes , remarks,
+	 date_format(audit_time,'%Y-%m-%d %H:%i:%S') auditTimes,attachment_url attachmentUrl, picture_url pictureUrl, amount,
+	 company_name companyName ,unit_price unitPrice,unit_number unitNumber,outsource_remarks outsourceRemarks,start_type startType,
+	 patent_name patentName,patent_type patentType,patent_name_type patentNameType
+	 from t_order_outsource
 	 where 1=1
 	  <if test="orderNo != null">
 	  and  order_no =  #{orderNo}

+ 3 - 11
src/main/java/com/goafanti/common/mapper/TOrderPaymentMapper.xml

@@ -567,18 +567,10 @@
   </insert>
   <select id="selectByidGetDetails" resultType="com.goafanti.organization.bo.outOrderPayment">
 select a.id,a.tid,a.node_id nodeId,a.payment_type paymentType,a.company_name companyName,a.quantity,
-	a.payment_status paymentStatus,a.status,a.payment_amount paymentAmount,a.remarks , b.quantity nodeQuantity,
-	d.finance_name financeName ,c.order_no orderNo,a.application_amount applicationAmount,
-	  b.party_amount nodePartyAmount,b.total_amount nodeTotalAmount,b.unit_price nodeUnitPrice
+	a.payment_status paymentStatus,a.status,a.payment_amount paymentAmount,a.remarks ,
+	d.finance_name financeName ,c.order_no orderNo,a.application_amount applicationAmount
 	 from t_order_payment a
-	 <if test="type==0">
-	 left join third_party_company b on a.tpc_id=b.id
-	 </if>
-	<if test="type==1">  
-	 left join payment_node b on a.node_id=b.id
-	 </if>
-	 left join t_order_task c on b.tid=c.id left join t_order_mid d on c.order_no=d.order_no where a.id= #{id}
-
+	 left join t_order_task c on a.tid=c.id left join t_order_mid d on c.order_no=d.order_no where a.id= #{id}
   </select>
   
   <select id="selectByTid" resultType="com.goafanti.organization.bo.outOrderPayment">

+ 446 - 430
src/main/java/com/goafanti/common/mapper/UserLockReleaseMapper.xml

@@ -1,431 +1,447 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.goafanti.common.dao.UserLockReleaseMapper">
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserLockRelease">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    <id column="id" jdbcType="VARCHAR" property="id" />
-    <result column="type" jdbcType="INTEGER" property="type" />
-    <result column="uid" jdbcType="VARCHAR" property="uid" />
-    <result column="aid" jdbcType="VARCHAR" property="aid" />
-    <result column="business_project_id" jdbcType="VARCHAR" property="businessProjectId" />
-    <result column="status" jdbcType="INTEGER" property="status" />
-    <result column="lock_time" jdbcType="DATE" property="lockTime" />
-    <result column="release_time" jdbcType="DATE" property="releaseTime" />
-    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
-  </resultMap>
-  <sql id="Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    <where>
-      <foreach collection="example.oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    id, type, uid, aid, business_project_id, status, lock_time, release_time, order_no
-  </sql>
-  <select id="selectByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    select
-    <if test="distinct">
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from user_lock_release
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    select 
-    <include refid="Base_Column_List" />
-    from user_lock_release
-    where id = #{id,jdbcType=VARCHAR}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    delete from user_lock_release
-    where id = #{id,jdbcType=VARCHAR}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    delete from user_lock_release
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.UserLockRelease">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    insert into user_lock_release (id, type, uid, 
-      aid, business_project_id, status, 
-      lock_time, release_time, order_no
-      )
-    values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, 
-      #{aid,jdbcType=VARCHAR}, #{businessProjectId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
-      #{lockTime,jdbcType=DATE}, #{releaseTime,jdbcType=DATE}, #{orderNo,jdbcType=VARCHAR}
-      )
-  </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.UserLockRelease">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    insert into user_lock_release
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="type != null">
-        type,
-      </if>
-      <if test="uid != null">
-        uid,
-      </if>
-      <if test="aid != null">
-        aid,
-      </if>
-      <if test="businessProjectId != null">
-        business_project_id,
-      </if>
-      <if test="status != null">
-        status,
-      </if>
-      <if test="lockTime != null">
-        lock_time,
-      </if>
-      <if test="releaseTime != null">
-        release_time,
-      </if>
-      <if test="orderNo != null">
-        order_no,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
-      <if test="type != null">
-        #{type,jdbcType=INTEGER},
-      </if>
-      <if test="uid != null">
-        #{uid,jdbcType=VARCHAR},
-      </if>
-      <if test="aid != null">
-        #{aid,jdbcType=VARCHAR},
-      </if>
-      <if test="businessProjectId != null">
-        #{businessProjectId,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        #{status,jdbcType=INTEGER},
-      </if>
-      <if test="lockTime != null">
-        #{lockTime,jdbcType=DATE},
-      </if>
-      <if test="releaseTime != null">
-        #{releaseTime,jdbcType=DATE},
-      </if>
-      <if test="orderNo != null">
-        #{orderNo,jdbcType=VARCHAR},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample" resultType="java.lang.Long">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    select count(*) from user_lock_release
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    update user_lock_release
-    <set>
-      <if test="record.id != null">
-        id = #{record.id,jdbcType=VARCHAR},
-      </if>
-      <if test="record.type != null">
-        type = #{record.type,jdbcType=INTEGER},
-      </if>
-      <if test="record.uid != null">
-        uid = #{record.uid,jdbcType=VARCHAR},
-      </if>
-      <if test="record.aid != null">
-        aid = #{record.aid,jdbcType=VARCHAR},
-      </if>
-      <if test="record.businessProjectId != null">
-        business_project_id = #{record.businessProjectId,jdbcType=VARCHAR},
-      </if>
-      <if test="record.status != null">
-        status = #{record.status,jdbcType=INTEGER},
-      </if>
-      <if test="record.lockTime != null">
-        lock_time = #{record.lockTime,jdbcType=DATE},
-      </if>
-      <if test="record.releaseTime != null">
-        release_time = #{record.releaseTime,jdbcType=DATE},
-      </if>
-      <if test="record.orderNo != null">
-        order_no = #{record.orderNo,jdbcType=VARCHAR},
-      </if>
-    </set>
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    update user_lock_release
-    set id = #{record.id,jdbcType=VARCHAR},
-      type = #{record.type,jdbcType=INTEGER},
-      uid = #{record.uid,jdbcType=VARCHAR},
-      aid = #{record.aid,jdbcType=VARCHAR},
-      business_project_id = #{record.businessProjectId,jdbcType=VARCHAR},
-      status = #{record.status,jdbcType=INTEGER},
-      lock_time = #{record.lockTime,jdbcType=DATE},
-      release_time = #{record.releaseTime,jdbcType=DATE},
-      order_no = #{record.orderNo,jdbcType=VARCHAR}
-    <if test="_parameter != null">
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserLockRelease">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    update user_lock_release
-    <set>
-      <if test="type != null">
-        type = #{type,jdbcType=INTEGER},
-      </if>
-      <if test="uid != null">
-        uid = #{uid,jdbcType=VARCHAR},
-      </if>
-      <if test="aid != null">
-        aid = #{aid,jdbcType=VARCHAR},
-      </if>
-      <if test="businessProjectId != null">
-        business_project_id = #{businessProjectId,jdbcType=VARCHAR},
-      </if>
-      <if test="status != null">
-        status = #{status,jdbcType=INTEGER},
-      </if>
-      <if test="lockTime != null">
-        lock_time = #{lockTime,jdbcType=DATE},
-      </if>
-      <if test="releaseTime != null">
-        release_time = #{releaseTime,jdbcType=DATE},
-      </if>
-      <if test="orderNo != null">
-        order_no = #{orderNo,jdbcType=VARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserLockRelease">
-    <!--
-      WARNING - @mbg.generated
-      This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon May 07 09:56:32 CST 2018.
-    -->
-    update user_lock_release
-    set type = #{type,jdbcType=INTEGER},
-      uid = #{uid,jdbcType=VARCHAR},
-      aid = #{aid,jdbcType=VARCHAR},
-      business_project_id = #{businessProjectId,jdbcType=VARCHAR},
-      status = #{status,jdbcType=INTEGER},
-      lock_time = #{lockTime,jdbcType=DATE},
-      release_time = #{releaseTime,jdbcType=DATE},
-      order_no = #{orderNo,jdbcType=VARCHAR}
-    where id = #{id,jdbcType=VARCHAR}
-  </update>
-  <delete id="deleteLockByOrder">
-  	delete from user_lock_release where order_no = #{orderNo,jdbcType=VARCHAR} and business_project_id = #{businessProjectId,jdbcType=VARCHAR}
-  </delete>
-  <update id="updateUserLock">
-  	update user_lock_release set status = #{newStatus} where uid = #{uid} and aid = #{aid} and type = 0 and status = #{oldStatus}
-  </update>
-  
-  <update id="updateUserTypeLock">
-  	update user_lock_release set status = #{newStatus} , release_time= #{date}
-  	where uid = #{uid} and aid = #{aid} and type = 0 and type = #{type}
-  </update>
-  
-  <select id="selectWaitReleaseCustomer" resultType="com.goafanti.customer.bo.LockingReleaseBo">
-	select 
-		t0.id,
-		t0.uid,
-		t0.aid,
-		t0.lock_time,
-		t1.last_follow_time
-	from
-		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
-	left join 
-		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-	on t0.uid = t1.uid 
-	where datediff(now(),if(t0.lock_time &lt; t1.last_follow_time,t1.last_follow_time,t1.t0.lock_time))>30 or datediff(now(),t0.lock_time)>270
-  </select>
-  
-  <select id="selectWaitReleaseBusiness"  resultType="com.goafanti.customer.bo.LockingReleaseBo">
-	select
-		t0.id,
-		t0.uid,
-		t0.aid,
-		t0.lock_time,
-		t1.last_follow_time
-	from
-		(select id,uid,aid,lock_time from user_lock_release t0 where aid = #{aid} and type = 1 and status = 0)t0
-	left join 
-		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
-	on t0.uid = t1.uid 
-	where datediff(t1.last_follow_time,lock_time)>360 or datediff(now(),t0.lock_time)>900
-  </select>
-  
-  <update id="updateReleaseLock" parameterType="java.lang.String">
-  		update user_lock_release set status = 2,release_time =  #{time} where status=1
-  </update>
-  
-  <update id="updatePendingReleaseLock" parameterType="java.lang.String">
-  	update user_lock_release set status = 1 where id in (${lockIds})
-  </update>
-  
-  <select id="selectPendinglockUserList" resultType="com.goafanti.customer.bo.LockingReleaseBo">
-  	select id,uid,type  from user_lock_release where status=1
-  </select>
-  
-  <update id="updateProject" parameterType="java.lang.String">
-  	update user_lock_release set status = 2,release_time=now()
-  	where uid= #{uid,jdbcType=VARCHAR}
-	and aid= #{aid,jdbcType=VARCHAR}
-	and business_project_id= #{businessProjectId,jdbcType=VARCHAR}
-  </update>
-  <select id="checkTask" resultType="com.goafanti.customer.bo.LockingReleaseBo">
-  	select 
-		 id, type, uid, aid, business_project_id as  businessProjectId, status 
-	 from user_lock_release where type =1
-	and status=0
-	and uid=#{buyerId,jdbcType=VARCHAR}
-	and business_project_id=#{commodityId,jdbcType=VARCHAR}
-  </select>
-  <update id="updatePrivateBusinessTransfer">
- 	update user_lock_release set aid=#{inputId} where uid= #{uid} and business_project_id= #{pid} and aid= #{aid}; 
-  </update>
-  
-  <select id="checkUserProject" resultType="com.goafanti.customer.bo.LockingReleaseBo">
-  	select 
-		 id, type, uid, aid, business_project_id as  businessProjectId, status 
-	 from user_lock_release where type =1
-	and status=0
-	and uid=#{uid,jdbcType=VARCHAR}
-	and aid=#{aid,jdbcType=VARCHAR}
-	and business_project_id=#{pid,jdbcType=VARCHAR}
-  </select>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.UserLockReleaseMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserLockRelease">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="type" jdbcType="INTEGER" property="type" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="business_project_id" jdbcType="VARCHAR" property="businessProjectId" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="lock_time" jdbcType="DATE" property="lockTime" />
+    <result column="release_time" jdbcType="DATE" property="releaseTime" />
+    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    id, type, uid, aid, business_project_id, status, lock_time, release_time, order_no
+  </sql>
+  <select id="selectByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from user_lock_release
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from user_lock_release
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    delete from user_lock_release
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    delete from user_lock_release
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.UserLockRelease">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    insert into user_lock_release (id, type, uid, 
+      aid, business_project_id, status, 
+      lock_time, release_time, order_no
+      )
+    values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, 
+      #{aid,jdbcType=VARCHAR}, #{businessProjectId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
+      #{lockTime,jdbcType=DATE}, #{releaseTime,jdbcType=DATE}, #{orderNo,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.UserLockRelease">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    insert into user_lock_release
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="type != null">
+        type,
+      </if>
+      <if test="uid != null">
+        uid,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="businessProjectId != null">
+        business_project_id,
+      </if>
+      <if test="status != null">
+        status,
+      </if>
+      <if test="lockTime != null">
+        lock_time,
+      </if>
+      <if test="releaseTime != null">
+        release_time,
+      </if>
+      <if test="orderNo != null">
+        order_no,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=INTEGER},
+      </if>
+      <if test="uid != null">
+        #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="businessProjectId != null">
+        #{businessProjectId,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="lockTime != null">
+        #{lockTime,jdbcType=DATE},
+      </if>
+      <if test="releaseTime != null">
+        #{releaseTime,jdbcType=DATE},
+      </if>
+      <if test="orderNo != null">
+        #{orderNo,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    select count(*) from user_lock_release
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    update user_lock_release
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.type != null">
+        type = #{record.type,jdbcType=INTEGER},
+      </if>
+      <if test="record.uid != null">
+        uid = #{record.uid,jdbcType=VARCHAR},
+      </if>
+      <if test="record.aid != null">
+        aid = #{record.aid,jdbcType=VARCHAR},
+      </if>
+      <if test="record.businessProjectId != null">
+        business_project_id = #{record.businessProjectId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.status != null">
+        status = #{record.status,jdbcType=INTEGER},
+      </if>
+      <if test="record.lockTime != null">
+        lock_time = #{record.lockTime,jdbcType=DATE},
+      </if>
+      <if test="record.releaseTime != null">
+        release_time = #{record.releaseTime,jdbcType=DATE},
+      </if>
+      <if test="record.orderNo != null">
+        order_no = #{record.orderNo,jdbcType=VARCHAR},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    update user_lock_release
+    set id = #{record.id,jdbcType=VARCHAR},
+      type = #{record.type,jdbcType=INTEGER},
+      uid = #{record.uid,jdbcType=VARCHAR},
+      aid = #{record.aid,jdbcType=VARCHAR},
+      business_project_id = #{record.businessProjectId,jdbcType=VARCHAR},
+      status = #{record.status,jdbcType=INTEGER},
+      lock_time = #{record.lockTime,jdbcType=DATE},
+      release_time = #{record.releaseTime,jdbcType=DATE},
+      order_no = #{record.orderNo,jdbcType=VARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserLockRelease">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    update user_lock_release
+    <set>
+      <if test="type != null">
+        type = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="uid != null">
+        uid = #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="businessProjectId != null">
+        business_project_id = #{businessProjectId,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        status = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="lockTime != null">
+        lock_time = #{lockTime,jdbcType=DATE},
+      </if>
+      <if test="releaseTime != null">
+        release_time = #{releaseTime,jdbcType=DATE},
+      </if>
+      <if test="orderNo != null">
+        order_no = #{orderNo,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserLockRelease">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon May 07 09:56:32 CST 2018.
+    -->
+    update user_lock_release
+    set type = #{type,jdbcType=INTEGER},
+      uid = #{uid,jdbcType=VARCHAR},
+      aid = #{aid,jdbcType=VARCHAR},
+      business_project_id = #{businessProjectId,jdbcType=VARCHAR},
+      status = #{status,jdbcType=INTEGER},
+      lock_time = #{lockTime,jdbcType=DATE},
+      release_time = #{releaseTime,jdbcType=DATE},
+      order_no = #{orderNo,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <delete id="deleteLockByOrder">
+  	delete from user_lock_release where order_no = #{orderNo,jdbcType=VARCHAR} and business_project_id = #{businessProjectId,jdbcType=VARCHAR}
+  </delete>
+  <update id="updateUserLock">
+  	update user_lock_release set status = #{newStatus} where uid = #{uid} and aid = #{aid} and type = 0 and status = #{oldStatus}
+  </update>
+  
+  <update id="updateUserTypeLock">
+  	update user_lock_release set status = #{newStatus} , release_time= #{date}
+  	where uid = #{uid} and aid = #{aid} and type = 0 and type = #{type}
+  </update>
+  
+  <select id="selectWaitReleaseCustomer" resultType="com.goafanti.customer.bo.LockingReleaseBo">
+	select 
+		t0.id,
+		t0.uid,
+		t0.aid,
+		t0.lock_time,
+		t1.last_follow_time
+	from
+		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
+	left join 
+		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
+	on t0.uid = t1.uid 
+	where datediff(now(),if(t0.lock_time &lt; t1.last_follow_time,t1.last_follow_time,t1.t0.lock_time))>30 or datediff(now(),t0.lock_time)>270
+  </select>
+  
+  <select id="selectWaitReleaseBusiness"  resultType="com.goafanti.customer.bo.LockingReleaseBo">
+	select
+		t0.id,
+		t0.uid,
+		t0.aid,
+		t0.lock_time,
+		t1.last_follow_time
+	from
+		(select id,uid,aid,lock_time from user_lock_release t0 where aid = #{aid} and type = 1 and status = 0)t0
+	left join 
+		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
+	on t0.uid = t1.uid 
+	where datediff(t1.last_follow_time,lock_time)>360 or datediff(now(),t0.lock_time)>900
+  </select>
+  
+  <update id="updateReleaseLock" parameterType="java.lang.String">
+  		update user_lock_release set status = 2,release_time =  #{time} where status=1
+  </update>
+  
+  <update id="updatePendingReleaseLock" parameterType="java.lang.String">
+  	update user_lock_release set status = 1 where id in (${lockIds})
+  </update>
+  
+  <select id="selectPendinglockUserList" resultType="com.goafanti.customer.bo.LockingReleaseBo">
+  	select id,uid,type  from user_lock_release where status=1
+  </select>
+  
+  <update id="updateProject" parameterType="java.lang.String">
+  	update user_lock_release set status = 2,release_time=now()
+  	where uid= #{uid,jdbcType=VARCHAR}
+	and aid= #{aid,jdbcType=VARCHAR}
+	and business_project_id= #{businessProjectId,jdbcType=VARCHAR}
+  </update>
+  <select id="checkTask" resultType="com.goafanti.customer.bo.LockingReleaseBo">
+  	select 
+		 id, type, uid, aid, business_project_id as  businessProjectId, status 
+	 from user_lock_release where type =1
+	and status=0
+	and uid=#{buyerId,jdbcType=VARCHAR}
+	and business_project_id=#{commodityId,jdbcType=VARCHAR}
+  </select>
+  <update id="updatePrivateBusinessTransfer">
+ 	update user_lock_release set aid=#{inputId} where uid= #{uid} and business_project_id= #{pid} and aid= #{aid}; 
+  </update>
+  
+  <select id="checkUserProject" resultType="com.goafanti.customer.bo.LockingReleaseBo">
+  	select 
+		 id, type, uid, aid, business_project_id as  businessProjectId, status 
+	 from user_lock_release where type =1
+	and status=0
+	and uid=#{uid,jdbcType=VARCHAR}
+	and aid=#{aid,jdbcType=VARCHAR}
+	and business_project_id=#{pid,jdbcType=VARCHAR}
+  </select>
+  
+  <select id="selectUserDays" resultType="com.goafanti.common.bo.userDaysBo">
+  
+  select 
+		t0.uid,
+		t0.aid,
+		u.nickname name
+	from
+		(select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
+	left join 
+		(select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
+	on t0.uid = t1.uid 
+	left join user u on t0.uid=u.id
+	where datediff(now(),if(t0.lock_time &lt; t1.last_follow_time,t1.last_follow_time,t1.t0.lock_time))> #{x} or datediff(now(),t0.lock_time)> #{y}
+  
+  </select>
 </mapper>

+ 185 - 176
src/main/java/com/goafanti/common/model/Notice.java

@@ -1,177 +1,186 @@
-package com.goafanti.common.model;
-
-import java.util.Date;
-
-import org.apache.commons.lang3.time.DateFormatUtils;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.enums.NoticeStatus;
-
-public class Notice {
-	private String	id;
-
-	private String	aid;
-
-	/**
-	 * 通知类型
-	 */
-	private Integer	noticeType;
-
-	/**
-	 * 通知内容
-	 */
-	private String	content;
-
-	/**
-	 * 创建时间
-	 */
-	private Date	createTime;
-	
-	/**
-	 * 已读标记
-	 */
-	private Integer	readed;
-	
-	/**
-	 * 用户id
-	 */
-	private String uid;
-	
-	/**
-	 * 录入公司信息业务员ID
-	 */
-	private String pid;
-	
-	/**
-	 * 业务记录ID
-	 */
-	private String rid;
-	
-	/**
-	 * 高企记录申请年份
-	 */
-	private Integer year;
-	
-	public Notice() {};
-//	Readed(0);//未读
-//	 n.setAid("1");
-//	 n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
-//	 n
-	public Notice(String id,Date createTime,Integer readed,String aid,Integer noticeType,String content) {
-		this.id=id;
-		this.createTime=createTime;
-		this.readed=readed;
-		this.aid=aid;
-		this.noticeType=noticeType;
-		this.content=content;
-	};
-
-	public Integer getYear() {
-		return year;
-	}
-
-	public void setYear(Integer year) {
-		this.year = year;
-	}
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	public String getAid() {
-		return aid;
-	}
-
-	public void setAid(String aid) {
-		this.aid = aid;
-	}
-
-
-	public Integer getNoticeType() {
-		return noticeType;
-	}
-
-	public void setNoticeType(Integer noticeType) {
-		this.noticeType = noticeType;
-	}
-
-	public String getContent() {
-		return content;
-	}
-
-	public void setContent(String content) {
-		this.content = content;
-	}
-
-	public Date getCreateTime() {
-		return createTime;
-	}
-
-	public void setCreateTime(Date createTime) {
-		this.createTime = createTime;
-	}
-
-	@JsonIgnore
-	public Integer getReaded() {
-		return readed;
-	}
-
-	public void setReaded(Integer readed) {
-		this.readed = readed;
-	}
-	
-	
-	public String getUid() {
-		return uid;
-	}
-
-	public void setUid(String uid) {
-		this.uid = uid;
-	}
-
-	
-
-	public String getPid() {
-		return pid;
-	}
-
-	public void setPid(String pid) {
-		this.pid = pid;
-	}
-
-	public String getRid() {
-		return rid;
-	}
-
-	public void setRid(String rid) {
-		this.rid = rid;
-	}
-
-	public String getNoticeTypeName(){
-		if (null == this.noticeType)return null;
-		return NoticeStatus.getValueByCode(this.noticeType);
-	}
-    
-	public void setNoticeTypeName(Integer noticeType){
-		
-	}
-	
-	public String getCreateTimeFormattedDate() {
-		if (this.createTime == null) {
-			return null;
-		} else {
-			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
-		}
-	}
-
-	public void setCreateTimeFormattedDate(String createTimeFormattedDate) {
-
-	}
-	
-	
+package com.goafanti.common.model;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.enums.NoticeStatus;
+
+public class Notice {
+	private String	id;
+
+	private String	aid;
+
+	/**
+	 * 通知类型
+	 */
+	private Integer	noticeType;
+
+	/**
+	 * 通知内容
+	 */
+	private String	content;
+
+	/**
+	 * 创建时间
+	 */
+	private Date	createTime;
+	
+	/**
+	 * 已读标记
+	 */
+	private Integer	readed;
+	
+	/**
+	 * 用户id
+	 */
+	private String uid;
+	
+	/**
+	 * 录入公司信息业务员ID
+	 */
+	private String pid;
+	
+	/**
+	 * 业务记录ID
+	 */
+	private String rid;
+	
+	/**
+	 * 高企记录申请年份
+	 */
+	private Integer year;
+	
+	public Notice() {};
+//	Readed(0);//未读
+//	 n.setAid("1");
+//	 n.setNoticeType(NoticeStatus.TASK_PATENT_ERROR.getCode());
+//	 n
+	/**
+	 * 
+	 * @param id 编号
+	 * @param createTime 创建时间
+	 * @param readed 0未读
+	 * @param aid 发件人
+	 * @param noticeType 标题
+	 * @param content  内容
+	 */
+	public Notice(String id,Date createTime,Integer readed,String aid,Integer noticeType,String content) {
+		this.id=id;
+		this.createTime=createTime;
+		this.readed=readed;
+		this.aid=aid;
+		this.noticeType=noticeType;
+		this.content=content;
+	};
+
+	public Integer getYear() {
+		return year;
+	}
+
+	public void setYear(Integer year) {
+		this.year = year;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getAid() {
+		return aid;
+	}
+
+	public void setAid(String aid) {
+		this.aid = aid;
+	}
+
+
+	public Integer getNoticeType() {
+		return noticeType;
+	}
+
+	public void setNoticeType(Integer noticeType) {
+		this.noticeType = noticeType;
+	}
+
+	public String getContent() {
+		return content;
+	}
+
+	public void setContent(String content) {
+		this.content = content;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	@JsonIgnore
+	public Integer getReaded() {
+		return readed;
+	}
+
+	public void setReaded(Integer readed) {
+		this.readed = readed;
+	}
+	
+	
+	public String getUid() {
+		return uid;
+	}
+
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+
+	
+
+	public String getPid() {
+		return pid;
+	}
+
+	public void setPid(String pid) {
+		this.pid = pid;
+	}
+
+	public String getRid() {
+		return rid;
+	}
+
+	public void setRid(String rid) {
+		this.rid = rid;
+	}
+
+	public String getNoticeTypeName(){
+		if (null == this.noticeType)return null;
+		return NoticeStatus.getValueByCode(this.noticeType);
+	}
+    
+	public void setNoticeTypeName(Integer noticeType){
+		
+	}
+	
+	public String getCreateTimeFormattedDate() {
+		if (this.createTime == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
+		}
+	}
+
+	public void setCreateTimeFormattedDate(String createTimeFormattedDate) {
+
+	}
+	
+	
 }

+ 0 - 3
src/main/java/com/goafanti/common/model/PaymentNode.java

@@ -5,9 +5,6 @@ import java.util.Date;
 
 import javax.validation.constraints.DecimalMax;
 import javax.validation.constraints.DecimalMin;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.Size;
 
 import com.goafanti.common.constant.ErrorConstants;
 

Diferenças do arquivo suprimidas por serem muito extensas
+ 812 - 813
src/main/java/com/goafanti/common/model/TArrearsDunExample.java


+ 0 - 3
src/main/java/com/goafanti/common/model/ThirdPartyCompany.java

@@ -5,9 +5,6 @@ import java.util.Date;
 
 import javax.validation.constraints.DecimalMax;
 import javax.validation.constraints.DecimalMin;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.Size;
 
 import com.goafanti.common.constant.ErrorConstants;
 

+ 372 - 366
src/main/java/com/goafanti/common/task/OrderDunTask.java

@@ -1,366 +1,372 @@
-package com.goafanti.common.task;
-
-
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-import javax.mail.MessagingException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Controller;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import com.goafanti.common.bo.EmailBo;
-import com.goafanti.common.bo.paymentNodeEmailBo;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.NoticeMapper;
-import com.goafanti.common.dao.PaymentNodeMapper;
-import com.goafanti.common.dao.TArrearsDunMapper;
-import com.goafanti.common.dao.TOrderMidMapper;
-import com.goafanti.common.dao.TOrderNewMapper;
-import com.goafanti.common.enums.NoticeStatus;
-import com.goafanti.common.model.Notice;
-import com.goafanti.common.model.PaymentNode;
-import com.goafanti.common.model.TArrearsDun;
-import com.goafanti.common.model.TOrderDun;
-import com.goafanti.common.model.TOrderMid;
-import com.goafanti.common.model.TOrderNew;
-import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.common.utils.SendEmailUtil;
-import com.goafanti.order.bo.InputNewOrderDunBo;
-import com.goafanti.order.bo.OrderDunTaskBo;
-import com.goafanti.order.bo.OutNewOrderDunBo;
-import com.goafanti.order.bo.TOrderNewBo;
-import com.goafanti.order.enums.OrderDunProjectType;
-import com.goafanti.order.service.NewOrderDunService;
-import com.goafanti.order.service.OrderNewService;
-import com.goafanti.order.service.OrderProjectService;
-import com.goafanti.organization.bo.OutPaymentNode;
-
-@Component
-@Controller
-public class OrderDunTask {
-	@Autowired
-	private OrderNewService orderNewService;
-	@Autowired
-	private NewOrderDunService  newOrderDunService;
-	@Autowired
-	private TOrderNewMapper	tOrderNewMapper;
-	@Autowired
-	private TArrearsDunMapper	tArrearsDunMapper;
-	@Autowired
-	private TOrderMidMapper	tOrderMidMapper;
-	@Autowired
-	private NoticeMapper	noticeMapper;
-	@Autowired
-	private PaymentNodeMapper	paymentNodeMapper;
-	@Autowired
-	private OrderProjectService	orderProjectService;
-	Logger							logger	= LoggerFactory.getLogger(OrderDunTask.class);
-	
-	
-	
-	/**
-	 * 每天凌晨3点轮询处理需要新催款的信息
-	 */
-	@RequestMapping(value = "/open/updateNewOrderDun", method = RequestMethod.GET)
-	@ResponseBody
-	@Scheduled(cron = "0 0 3  * * ?")
-	@Transactional(rollbackFor=Exception.class)
-	public void updateNewOrderDun(){
-  		try {
-  			LoggerUtils.debug(logger, "======================新催款任务轮询启动===================");
-  		
-  		List<OutNewOrderDunBo> list= newOrderDunService.selectAllOrderDun();
-  		Calendar calendar=Calendar.getInstance();   
-  		Calendar calendar2=Calendar.getInstance();
-  		Date date =new Date();
-  		for (OutNewOrderDunBo o : list) {
-  			calendar.setTime(date);
-  			calendar2.setTime(o.getCreateTime());
-  			if (o!=null&&o.getApproval()!=null&&o.getApproval()!=0&&o.getDunType()==1&&o.getWaitDay()!=null) {
-  					calendar2.add(Calendar.DATE, o.getWaitDay());
-  					if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
-  						updateOrderDun(o);
-  						Thread.sleep(2000);
-  					}
-			}
-  			if(o.getProjectType()==OrderDunProjectType.HY.getCode()&&o.getDunType()==2) {
-  				calendar2.add(Calendar.DATE, o.getEffectiveCount()*180);
-  				CalendarTimeCleared(calendar2);
-  				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
-  	  	  			updateOrderDun(o);
-  	  	  			Thread.sleep(2000);
-  				}
-  			}
-  			if(o.getProjectType()==OrderDunProjectType.CS.getCode()&&o.getDunType()==2) {
-  			//获取年
-  				int year = calendar2.get(Calendar.YEAR);  
-  		        //获取月份,0表示1月份
-  		        int month = calendar2.get(Calendar.MONTH) + 1;
-  		        if(month<10)year=year+1;
-  		        if(month>9)year=year+2;
-  		        calendar2.set(year, 5, 1);
-  		        CalendarTimeCleared(calendar2);
-  				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
-  	  	  			updateOrderDun(o);
-  	  	  			Thread.sleep(2000);
-  				}
-  			}
-  	  		if (o.getDunType()==0) {
-  	  		calendar2.setTime(o.getCustomizeTime());
-  	  		CalendarTimeCleared(calendar);
-  	  			if (calendar.equals(calendar2)) {
-  	  				updateOrderDun(o);
-	  	  			Thread.sleep(2000);
-				}
-				
-			}
-		}
-  		LoggerUtils.debug(logger, "======================催款任务结束,付款催款开始===================");
-  		List<OutPaymentNode> list2=paymentNodeMapper.selectByStatus(0);
-  		for (OutPaymentNode pn : list2) {
-  			calendar2.setTime(pn.getCreateTime());
-  			if(pn.getProjectType()==OrderDunProjectType.HY.getCode()&&pn.getDunType()==2) {
-  				calendar2.add(Calendar.DATE, pn.getEffectiveCount()*180);
-  				CalendarTimeCleared(calendar2);
-  				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
-  					updatePaymentNode(pn);
-  	  	  			Thread.sleep(2000);
-  				}
-  			}
-  			if(pn.getProjectType()==OrderDunProjectType.CS.getCode()&&pn.getDunType()==2) {
-  				//	获取年
-  				int year = calendar2.get(Calendar.YEAR);  
-  		        //获取月份,0表示1月份
-  		        int month = calendar2.get(Calendar.MONTH) + 1;
-  		        if(month<10)year=year+1;
-  		        if(month>9)year=year+2;
-  		        calendar2.set(year, 5, 1);
-  		        CalendarTimeCleared(calendar2);
-  				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
-  					updatePaymentNode(pn);
-  	  	  			Thread.sleep(2000);
-  				}
-  			}
-  	  		if (pn.getDunType()==0) {
-  	  		calendar2.setTime(pn.getPartyTime());
-  	  		CalendarTimeCleared(calendar);
-  	  			if (calendar.equals(calendar2)) {
-  	  				updatePaymentNode(pn);
-	  	  			Thread.sleep(2000);
-				}
-				
-			}
-		}
-  		} catch (Exception e) {
-  			EmailBo emailBo = new EmailBo( "催款处理失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统", "催款处理失败");
-			try {
-				SendEmailUtil.getInstance().send(emailBo);
-			} catch (UnsupportedEncodingException | MessagingException e1) {
-				e1.printStackTrace();
-			}
-  			LoggerUtils.error(getClass(), "=============================================");
-			LoggerUtils.error(getClass(), "新催款的信息处理失败", e);
-			LoggerUtils.error(getClass(), "=============================================");
-		}
-  	
-  		//处理旧催款
-  		updateorderDun();
-  		
-  	}
-	
-	
-	private void updatePaymentNode(OutPaymentNode pn) {
-		PaymentNode p=new PaymentNode();
-		p.setId(pn.getId());
-		p.setDunStatus(1);
-		p.setStartTime(new Date());
-		paymentNodeMapper.updateByPrimaryKeySelective(p);
-		orderProjectService.addNoticAndEmail(pn,NoticeStatus.PAYMENT_DUN.getCode());
-	}
-	
-	
-
-
-	private void CalendarTimeCleared(Calendar calendar) {
-		calendar.set(Calendar.HOUR_OF_DAY, 0);
-	    calendar.set(Calendar.MINUTE, 0);
-	    calendar.set(Calendar.SECOND, 0);
-	    calendar.set(Calendar.MILLISECOND, 0);
-	}
-
-
-	private void updateOrderDun(OutNewOrderDunBo t) throws UnsupportedEncodingException, MessagingException {
-		InputNewOrderDunBo o=new InputNewOrderDunBo();
-		o.setId(t.getId());
-		o.setStatus(1);
-		o.setStartTime(new Date());
-		newOrderDunService.updateDun(o);
-		tOrderMidMapper.addOrderReceivables(t.getOrderNo(),t.getMoney());
-		TOrderMid tm=tOrderMidMapper.selectByOrderNo(t.getOrderNo());
-			TArrearsDun td=new TArrearsDun();
-			td.setOrderArrears(tm.getOrderArrears());
-			td.setOrderReceivables(tm.getOrderReceivables());
-			if (tArrearsDunMapper.checkOrderNo(t.getOrderNo(),null)<1) {
-				td.setOrderNo(t.getOrderNo());
-				tArrearsDunMapper.insertSelective(td);
-			}else if(tArrearsDunMapper.checkOrderNo(t.getOrderNo(),0)>0){
-				Integer i=tArrearsDunMapper.selectByStatus(t.getOrderNo(), 0);
-				td.setId(i);
-				tArrearsDunMapper.updateByPrimaryKeySelective(td);
-			}
-		TOrderNew t2=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
-		orderNewService.addTimingTaskNewDunNoticAndSendEmail(t2, t);
-	}
-	
-	/**
-	* 	每月1号凌晨4点轮询处理需要欠款催款的信息
-	*
-	*/
-	@Scheduled(cron = "0 0 4 1 * ?") 
-	@RequestMapping(value = "/open/pushOrderArrearsDun", method = RequestMethod.GET)
-  	@Transactional(rollbackFor=Exception.class)
-	public void pushOrderArrearsDun(){
-		try {
-			LoggerUtils.debug(logger, "======================欠款催款启动===================");
-			Date date=new Date();
-			//运算 list(未启动) list2(催款中) list3(已完成)订单的欠款催款
-			List<TArrearsDun> list=tArrearsDunMapper.selectStatusAll(0);
-			List<TArrearsDun> list2=tArrearsDunMapper.selectStatusAll(1);
-			List<TArrearsDun> list3=tArrearsDunMapper.selectStatusAndAmount(2);
-			for (TArrearsDun td : list) {
-				TOrderMid tm=tOrderMidMapper.selectByOrderNo(td.getOrderNo());
-				//如果欠款大于0则需要触发邮件
-				if (tm.getOrderArrears().compareTo(new BigDecimal(0))>0) {
-					td.setDunStatus(1);
-					td.setStartTime(date);
-					td.setOrderArrears(tm.getOrderArrears());
-					td.setOrderReceivables(tm.getOrderReceivables());
-					addNoticAndSendEmail(td.getOrderNo(),td,NoticeStatus.ORDER_ARREARS_DUN.getCode());
-					tArrearsDunMapper.updateByPrimaryKeySelective(td);
-				}else if(tm.getOrderArrears().compareTo(new BigDecimal(0))<1) {
-					td.setDunStatus(2);
-					td.setEndTime(date);
-					td.setOrderArrears(tm.getOrderArrears());
-					tArrearsDunMapper.updateByPrimaryKeySelective(td);
-				}
-				Thread.sleep(2000);
-			}
-			for (TArrearsDun ta : list2) {
-				TOrderMid tm=tOrderMidMapper.selectByOrderNo(ta.getOrderNo());
-				//如果欠款大于0则需要触发邮件
-				if (tm.getOrderArrears().compareTo(new BigDecimal(0))>0) {
-					ta.setDunStatus(3);
-					tArrearsDunMapper.updateByPrimaryKeySelective(ta);
-					ta.setId(null);
-					ta.setDunStatus(1);
-					ta.setStartTime(date);
-					ta.setOrderArrears(tm.getOrderArrears());
-					ta.setOrderReceivables(tm.getOrderReceivables());
-					tArrearsDunMapper.insertSelective(ta);
-					addNoticAndSendEmail(ta.getOrderNo(),ta,NoticeStatus.ORDER_ARREARS_DUN.getCode());
-				}else if(tm.getOrderArrears().compareTo(new BigDecimal(0))<1) {
-					ta.setDunStatus(2);
-					ta.setOrderArrears(tm.getOrderArrears());
-					tArrearsDunMapper.updateByPrimaryKeySelective(ta);
-				}
-				Thread.sleep(2000);
-			
-			}
-			for (TArrearsDun ta : list3) {
-				TOrderMid tm=tOrderMidMapper.selectByOrderNo(ta.getOrderNo());
-				//如果欠款大于0则需要触发邮件
-				if (tm.getOrderArrears().compareTo(new BigDecimal(0))>0) {
-					ta.setDunStatus(3);
-					tArrearsDunMapper.updateByPrimaryKeySelective(ta);
-					ta.setId(null);
-					ta.setDunStatus(1);
-					ta.setStartTime(date);
-					ta.setOrderArrears(tm.getOrderArrears());
-					ta.setOrderReceivables(tm.getOrderReceivables());
-					tArrearsDunMapper.insertSelective(ta);
-					addNoticAndSendEmail(ta.getOrderNo(),ta,NoticeStatus.ORDER_ARREARS_DUN.getCode());
-				}else if(tm.getOrderArrears().compareTo(new BigDecimal(0))<1) {
-					ta.setDunStatus(2);
-					ta.setOrderReceivables(tm.getOrderReceivables());
-					ta.setOrderArrears(tm.getOrderArrears());
-					tArrearsDunMapper.updateByPrimaryKeySelective(ta);
-				}
-				Thread.sleep(2000);
-			
-			}
-		} catch (Exception e) {
-			LoggerUtils.error(getClass(), "===========================欠款催款失败==========================", e);
-		}
-	}
-	
-	
-	private void addNoticAndSendEmail(String orderNo, TArrearsDun td, Integer code) throws UnsupportedEncodingException, MessagingException {
-		TOrderNewBo b  = tOrderNewMapper.getSaleIdByOno(orderNo);
-			String str=NoticeStatus.getValueByCode(code)+": 订单编号 -"+orderNo+", 操作人: 平台超管中心 - yxy。";
-			Notice n =new Notice();
-			n.setId(UUID.randomUUID().toString());
-			n.setAid(b.getSalesmanId());
-			n.setNoticeType(code);
-			n.setContent(str);
-			n.setReaded(0);//未读
-			noticeMapper.insertSelective(n);
-	}
-
-
-	/**
-	*
-	*
-	*/
-//	@RequestMapping(value = "/open/updateOrderDun", method = RequestMethod.GET)
-	@Scheduled(cron = "0 0 2  * * ?") 
-  	@Transactional(rollbackFor=Exception.class)
-	public void updateorderDun(){
-  		try {
-  			LoggerUtils.debug(logger, "======================催款任务轮询启动===================");
-  		List<OrderDunTaskBo> list=orderNewService.selectAllOrderDun();
-  		for (OrderDunTaskBo t : list) {
-			if (t.getDunSubject()/10==1) {//1则为订单催款信息否则为项目催款信息
-				if (t.getDunSubject()%10==t.getOrderStatus()&&t.getSettlementAmount().compareTo(t.getMoney()) == -1) {
-					 updateOrderDun(t);
-						Thread.sleep(2000);
-				}
-			}else {
-				if (t.getDunSubject()%10>=t.getProjectStatus()&&t.getSettlementAmount().compareTo(t.getMoney()) == -1) {
-					 updateOrderDun(t);
-					 Thread.sleep(2000);
-				}
-			}
-		}
-  		} catch (Exception e) {
-  			LoggerUtils.error(getClass(), "=============================================");
-			LoggerUtils.error(getClass(), "催款的信息处理失败", e);
-			LoggerUtils.error(getClass(), "=============================================");
-		}
-  		
-  	}
-
-
-	private void updateOrderDun(OrderDunTaskBo t) throws UnsupportedEncodingException, MessagingException {
-		LoggerUtils.debug(logger, "======================修改催款任务===================");
-		TOrderDun tDun=new TOrderDun();
-		 tDun.setId(t.getId());
-		 tDun.setDunStatus(1);
-		 tDun.setStartTime(new Date());
-		 orderNewService.updateOrderDun(tDun);
-		orderNewService.addNoticAndSendEmail(t.getOrderNo(),t,NoticeStatus.ORDER_DUN.getCode());
-	}
-  
-}
+package com.goafanti.common.task;
+
+
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import javax.mail.MessagingException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Controller;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.goafanti.common.bo.EmailBo;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.NoticeMapper;
+import com.goafanti.common.dao.PaymentNodeMapper;
+import com.goafanti.common.dao.TArrearsDunMapper;
+import com.goafanti.common.dao.TOrderMidMapper;
+import com.goafanti.common.dao.TOrderNewMapper;
+import com.goafanti.common.enums.NoticeStatus;
+import com.goafanti.common.model.Notice;
+import com.goafanti.common.model.PaymentNode;
+import com.goafanti.common.model.TArrearsDun;
+import com.goafanti.common.model.TOrderDun;
+import com.goafanti.common.model.TOrderMid;
+import com.goafanti.common.model.TOrderNew;
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.common.utils.SendEmailUtil;
+import com.goafanti.order.bo.InputNewOrderDunBo;
+import com.goafanti.order.bo.OrderDunTaskBo;
+import com.goafanti.order.bo.OutNewOrderDunBo;
+import com.goafanti.order.bo.TOrderNewBo;
+import com.goafanti.order.enums.OrderDunProjectType;
+import com.goafanti.order.service.NewOrderDunService;
+import com.goafanti.order.service.OrderNewService;
+import com.goafanti.order.service.OrderProjectService;
+import com.goafanti.organization.bo.OutPaymentNode;
+
+@Component
+@Controller
+public class OrderDunTask {
+	@Autowired
+	private OrderNewService orderNewService;
+	@Autowired
+	private NewOrderDunService  newOrderDunService;
+	@Autowired
+	private TOrderNewMapper	tOrderNewMapper;
+	@Autowired
+	private TArrearsDunMapper	tArrearsDunMapper;
+	@Autowired
+	private TOrderMidMapper	tOrderMidMapper;
+	@Autowired
+	private NoticeMapper	noticeMapper;
+	@Autowired
+	private PaymentNodeMapper	paymentNodeMapper;
+	@Autowired
+	private OrderProjectService	orderProjectService;
+	Logger							logger	= LoggerFactory.getLogger(OrderDunTask.class);
+	
+	/**
+	 * 	每天凌晨3点轮
+	 * @throws InterruptedException
+	 */
+	@ResponseBody
+	@Scheduled(cron = "0 0 3  * * ?")
+	@Transactional(rollbackFor=Exception.class)
+	public void startTask() throws InterruptedException {
+		updateNewOrderDun();
+		Thread.sleep(2000);
+		updateorderDun();
+	}
+	
+	/**
+	 * 询处理需要新催款的信息
+	 */
+	@RequestMapping(value = "/open/updateNewOrderDun", method = RequestMethod.GET)
+	public void updateNewOrderDun(){
+  		try {
+  			LoggerUtils.debug(logger, "======================新催款任务轮询启动===================");
+  		
+  		List<OutNewOrderDunBo> list= newOrderDunService.selectAllOrderDun();
+  		Calendar calendar=Calendar.getInstance();   
+  		Calendar calendar2=Calendar.getInstance();
+  		Date date =new Date();
+  		for (OutNewOrderDunBo o : list) {
+  			calendar.setTime(date);
+  			calendar2.setTime(o.getCreateTime());
+  			if (o!=null&&o.getApproval()!=null&&o.getApproval()!=0&&o.getDunType()==1&&o.getWaitDay()!=null) {
+  					calendar2.add(Calendar.DATE, o.getWaitDay());
+  					if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
+  						updateOrderDun(o);
+  						Thread.sleep(2000);
+  					}
+			}
+  			if(o.getProjectType()==OrderDunProjectType.HY.getCode()&&o.getDunType()==2) {
+  				calendar2.add(Calendar.DATE, o.getEffectiveCount()*180);
+  				CalendarTimeCleared(calendar2);
+  				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
+  	  	  			updateOrderDun(o);
+  	  	  			Thread.sleep(2000);
+  				}
+  			}
+  			if(o.getProjectType()==OrderDunProjectType.CS.getCode()&&o.getDunType()==2) {
+  			//获取年
+  				int year = calendar2.get(Calendar.YEAR);  
+  		        //获取月份,0表示1月份
+  		        int month = calendar2.get(Calendar.MONTH) + 1;
+  		        if(month<10)year=year+1;
+  		        if(month>9)year=year+2;
+  		        calendar2.set(year, 5, 1);
+  		        CalendarTimeCleared(calendar2);
+  				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
+  	  	  			updateOrderDun(o);
+  	  	  			Thread.sleep(2000);
+  				}
+  			}
+  	  		if (o.getDunType()==0) {
+  	  		calendar2.setTime(o.getCustomizeTime());
+  	  		CalendarTimeCleared(calendar);
+  	  			if (calendar.equals(calendar2)) {
+  	  				updateOrderDun(o);
+	  	  			Thread.sleep(2000);
+				}
+				
+			}
+		}
+  		LoggerUtils.debug(logger, "======================催款任务结束,付款催款开始===================");
+  		List<OutPaymentNode> list2=paymentNodeMapper.selectByStatus(0);
+  		for (OutPaymentNode pn : list2) {
+  			calendar2.setTime(pn.getCreateTime());
+  			if(pn.getProjectType()==OrderDunProjectType.HY.getCode()&&pn.getDunType()==2) {
+  				calendar2.add(Calendar.DATE, pn.getEffectiveCount()*180);
+  				CalendarTimeCleared(calendar2);
+  				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
+  					updatePaymentNode(pn);
+  	  	  			Thread.sleep(2000);
+  				}
+  			}
+  			if(pn.getProjectType()==OrderDunProjectType.CS.getCode()&&pn.getDunType()==2) {
+  				//	获取年
+  				int year = calendar2.get(Calendar.YEAR);  
+  		        //获取月份,0表示1月份
+  		        int month = calendar2.get(Calendar.MONTH) + 1;
+  		        if(month<10)year=year+1;
+  		        if(month>9)year=year+2;
+  		        calendar2.set(year, 5, 1);
+  		        CalendarTimeCleared(calendar2);
+  				if (calendar.getTimeInMillis() > calendar2.getTimeInMillis()) {//当前时间大于计算后时间则触发
+  					updatePaymentNode(pn);
+  	  	  			Thread.sleep(2000);
+  				}
+  			}
+  	  		if (pn.getDunType()==0) {
+  	  		calendar2.setTime(pn.getPartyTime());
+  	  		CalendarTimeCleared(calendar);
+  	  			if (calendar.equals(calendar2)) {
+  	  				updatePaymentNode(pn);
+	  	  			Thread.sleep(2000);
+				}
+				
+			}
+		}
+  		} catch (Exception e) {
+  			EmailBo emailBo = new EmailBo( "催款处理失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统", "催款处理失败");
+			try {
+				SendEmailUtil.getInstance().send(emailBo);
+			} catch (UnsupportedEncodingException | MessagingException e1) {
+				e1.printStackTrace();
+			}
+  			LoggerUtils.error(getClass(), "=============================================");
+			LoggerUtils.error(getClass(), "新催款的信息处理失败", e);
+			LoggerUtils.error(getClass(), "=============================================");
+		}
+  	
+  		//处理旧催款
+  		updateorderDun();
+  		
+  	}
+	
+	
+	private void updatePaymentNode(OutPaymentNode pn) {
+		PaymentNode p=new PaymentNode();
+		p.setId(pn.getId());
+		p.setDunStatus(1);
+		p.setStartTime(new Date());
+		paymentNodeMapper.updateByPrimaryKeySelective(p);
+		orderProjectService.addNoticAndEmail(pn,NoticeStatus.PAYMENT_DUN.getCode());
+	}
+	
+	
+
+
+	private void CalendarTimeCleared(Calendar calendar) {
+		calendar.set(Calendar.HOUR_OF_DAY, 0);
+	    calendar.set(Calendar.MINUTE, 0);
+	    calendar.set(Calendar.SECOND, 0);
+	    calendar.set(Calendar.MILLISECOND, 0);
+	}
+
+
+	private void updateOrderDun(OutNewOrderDunBo t) throws UnsupportedEncodingException, MessagingException {
+		InputNewOrderDunBo o=new InputNewOrderDunBo();
+		o.setId(t.getId());
+		o.setStatus(1);
+		o.setStartTime(new Date());
+		newOrderDunService.updateDun(o);
+		tOrderMidMapper.addOrderReceivables(t.getOrderNo(),t.getMoney());
+		TOrderMid tm=tOrderMidMapper.selectByOrderNo(t.getOrderNo());
+			TArrearsDun td=new TArrearsDun();
+			td.setOrderArrears(tm.getOrderArrears());
+			td.setOrderReceivables(tm.getOrderReceivables());
+			if (tArrearsDunMapper.checkOrderNo(t.getOrderNo(),null)<1) {
+				td.setOrderNo(t.getOrderNo());
+				tArrearsDunMapper.insertSelective(td);
+			}else if(tArrearsDunMapper.checkOrderNo(t.getOrderNo(),0)>0){
+				Integer i=tArrearsDunMapper.selectByStatus(t.getOrderNo(), 0);
+				td.setId(i);
+				tArrearsDunMapper.updateByPrimaryKeySelective(td);
+			}
+		TOrderNew t2=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
+		orderNewService.addTimingTaskNewDunNoticAndSendEmail(t2, t);
+	}
+	
+	/**
+	* 	每月1号凌晨4点轮询处理需要欠款催款的信息
+	*
+	*/
+	@Scheduled(cron = "0 0 4 1 * ?") 
+	@RequestMapping(value = "/open/pushOrderArrearsDun", method = RequestMethod.GET)
+	public void pushOrderArrearsDun(){
+		try {
+			LoggerUtils.debug(logger, "======================欠款催款启动===================");
+			Date date=new Date();
+			//运算 list(未启动) list2(催款中) list3(已完成)订单的欠款催款
+			List<TArrearsDun> list=tArrearsDunMapper.selectStatusAll(0);
+			List<TArrearsDun> list2=tArrearsDunMapper.selectStatusAll(1);
+			List<TArrearsDun> list3=tArrearsDunMapper.selectStatusAndAmount(2);
+			for (TArrearsDun td : list) {
+				TOrderMid tm=tOrderMidMapper.selectByOrderNo(td.getOrderNo());
+				//如果欠款大于0则需要触发邮件
+				if (tm.getOrderArrears().compareTo(new BigDecimal(0))>0) {
+					td.setDunStatus(1);
+					td.setStartTime(date);
+					td.setOrderArrears(tm.getOrderArrears());
+					td.setOrderReceivables(tm.getOrderReceivables());
+					addNoticAndSendEmail(td.getOrderNo(),td,NoticeStatus.ORDER_ARREARS_DUN.getCode());
+					tArrearsDunMapper.updateByPrimaryKeySelective(td);
+				}else if(tm.getOrderArrears().compareTo(new BigDecimal(0))<1) {
+					td.setDunStatus(2);
+					td.setEndTime(date);
+					td.setOrderArrears(tm.getOrderArrears());
+					tArrearsDunMapper.updateByPrimaryKeySelective(td);
+				}
+				Thread.sleep(2000);
+			}
+			for (TArrearsDun ta : list2) {
+				TOrderMid tm=tOrderMidMapper.selectByOrderNo(ta.getOrderNo());
+				//如果欠款大于0则需要触发邮件
+				if (tm.getOrderArrears().compareTo(new BigDecimal(0))>0) {
+					ta.setDunStatus(3);
+					tArrearsDunMapper.updateByPrimaryKeySelective(ta);
+					ta.setId(null);
+					ta.setDunStatus(1);
+					ta.setStartTime(date);
+					ta.setOrderArrears(tm.getOrderArrears());
+					ta.setOrderReceivables(tm.getOrderReceivables());
+					tArrearsDunMapper.insertSelective(ta);
+					addNoticAndSendEmail(ta.getOrderNo(),ta,NoticeStatus.ORDER_ARREARS_DUN.getCode());
+				}else if(tm.getOrderArrears().compareTo(new BigDecimal(0))<1) {
+					ta.setDunStatus(2);
+					ta.setOrderArrears(tm.getOrderArrears());
+					tArrearsDunMapper.updateByPrimaryKeySelective(ta);
+				}
+				Thread.sleep(2000);
+			
+			}
+			for (TArrearsDun ta : list3) {
+				TOrderMid tm=tOrderMidMapper.selectByOrderNo(ta.getOrderNo());
+				//如果欠款大于0则需要触发邮件
+				if (tm.getOrderArrears().compareTo(new BigDecimal(0))>0) {
+					ta.setDunStatus(3);
+					tArrearsDunMapper.updateByPrimaryKeySelective(ta);
+					ta.setId(null);
+					ta.setDunStatus(1);
+					ta.setStartTime(date);
+					ta.setOrderArrears(tm.getOrderArrears());
+					ta.setOrderReceivables(tm.getOrderReceivables());
+					tArrearsDunMapper.insertSelective(ta);
+					addNoticAndSendEmail(ta.getOrderNo(),ta,NoticeStatus.ORDER_ARREARS_DUN.getCode());
+				}else if(tm.getOrderArrears().compareTo(new BigDecimal(0))<1) {
+					ta.setDunStatus(2);
+					ta.setOrderReceivables(tm.getOrderReceivables());
+					ta.setOrderArrears(tm.getOrderArrears());
+					tArrearsDunMapper.updateByPrimaryKeySelective(ta);
+				}
+				Thread.sleep(2000);
+			
+			}
+		} catch (Exception e) {
+			LoggerUtils.error(getClass(), "===========================欠款催款失败==========================", e);
+		}
+	}
+	
+	
+	private void addNoticAndSendEmail(String orderNo, TArrearsDun td, Integer code) throws UnsupportedEncodingException, MessagingException {
+		TOrderNewBo b  = tOrderNewMapper.getSaleIdByOno(orderNo);
+			String str=NoticeStatus.getValueByCode(code)+": 订单编号 -"+orderNo+", 操作人: 平台超管中心 - yxy。";
+			Notice n =new Notice();
+			n.setId(UUID.randomUUID().toString());
+			n.setAid(b.getSalesmanId());
+			n.setNoticeType(code);
+			n.setContent(str);
+			n.setReaded(0);//未读
+			noticeMapper.insertSelective(n);
+	}
+
+
+	/**
+	*
+	*
+	*/
+//	@RequestMapping(value = "/open/updateOrderDun", method = RequestMethod.GET)
+//	@Scheduled(cron = "0 0 2  * * ?") 
+  	@Transactional(rollbackFor=Exception.class)
+	public void updateorderDun(){
+  		try {
+  			LoggerUtils.debug(logger, "======================催款任务轮询启动===================");
+  		List<OrderDunTaskBo> list=orderNewService.selectAllOrderDun();
+  		for (OrderDunTaskBo t : list) {
+			if (t.getDunSubject()/10==1) {//1则为订单催款信息否则为项目催款信息
+				if (t.getDunSubject()%10==t.getOrderStatus()&&t.getSettlementAmount().compareTo(t.getMoney()) == -1) {
+					 updateOrderDun(t);
+						Thread.sleep(2000);
+				}
+			}else {
+				if (t.getDunSubject()%10>=t.getProjectStatus()&&t.getSettlementAmount().compareTo(t.getMoney()) == -1) {
+					 updateOrderDun(t);
+					 Thread.sleep(2000);
+				}
+			}
+		}
+  		} catch (Exception e) {
+  			LoggerUtils.error(getClass(), "=============================================");
+			LoggerUtils.error(getClass(), "催款的信息处理失败", e);
+			LoggerUtils.error(getClass(), "=============================================");
+		}
+  		
+  	}
+
+
+	private void updateOrderDun(OrderDunTaskBo t) throws UnsupportedEncodingException, MessagingException {
+		LoggerUtils.debug(logger, "======================修改催款任务===================");
+		TOrderDun tDun=new TOrderDun();
+		 tDun.setId(t.getId());
+		 tDun.setDunStatus(1);
+		 tDun.setStartTime(new Date());
+		 orderNewService.updateOrderDun(tDun);
+		orderNewService.addNoticAndSendEmail(t.getOrderNo(),t,NoticeStatus.ORDER_DUN.getCode());
+	}
+  
+}

+ 161 - 114
src/main/java/com/goafanti/common/task/ReleaseUserTask.java

@@ -1,114 +1,161 @@
-package com.goafanti.common.task;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-import javax.annotation.Resource;
-import javax.mail.MessagingException;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-
-import com.goafanti.common.bo.EmailBo;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.NoticeMapper;
-import com.goafanti.common.enums.NoticeStatus;
-import com.goafanti.common.model.Notice;
-import com.goafanti.common.model.User;
-import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.common.utils.SendEmailUtil;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.customer.bo.LockingReleaseBo;
-import com.goafanti.customer.service.CustomerService;
-import com.goafanti.user.service.UserService;
-
-@Component
-@Controller
-public class ReleaseUserTask {
-	@Resource
-	private CustomerService customerServiceImpl;
-	@Resource
-	private UserService userServiceImpl;
-	@Autowired
-	private NoticeMapper	noticeMapper;
-	
-	int pointsDataLimit=50;
-	
-	/**
-	 * 每天凌晨一点将客户和业务转为待释放
-	 */
-	
-	@Scheduled(cron = "0 0 1  * * ?") 
-	@RequestMapping(value = "/open/updateUser", method = RequestMethod.GET)
-	public void updateUser(){
-		LoggerUtils.debug(getClass(), "==============客户释放开始============");
-		Date releaseTime = new Date();
-		try {
-			List<User> userList = userServiceImpl.selectUserByRoleName("营销员","营销经理");
-			List<LockingReleaseBo> lockUserList = new ArrayList<LockingReleaseBo>();
-			List<LockingReleaseBo> lockBusinessList = new ArrayList<LockingReleaseBo>();
-			List<LockingReleaseBo> userTmpList = null;
-			List<LockingReleaseBo> businessTmpList = null;
-			if (userList!=null&&!userList.isEmpty()) {
-				for(User u : userList){
-					if(StringUtils.isNotBlank(u.getId())) {
-						userTmpList = customerServiceImpl.selectWaitReleaseCustomer(u.getId());
-//						userTmpList = customerServiceImpl.selectWaitReleaseCustomer("1");
-							if(userTmpList!=null&&!userTmpList.isEmpty())lockUserList.addAll(userTmpList);
-							businessTmpList = customerServiceImpl.selectWaitReleaseBusiness(u.getId());
-//						businessTmpList = customerServiceImpl.selectWaitReleaseBusiness("1");
-							if(businessTmpList!=null&&!businessTmpList.isEmpty())lockBusinessList.addAll(businessTmpList);
-						}
-				}
-				
-			}
-		List<LockingReleaseBo> newList=new ArrayList<LockingReleaseBo>();
-			  if (lockUserList!=null&&lockUserList.size()>0) {
-				  for(int i=0;i<lockUserList.size();i++){
-					  newList.add(lockUserList.get(i));
-					  if(pointsDataLimit == newList.size()||i == lockUserList.size()-1){
-						  if(newList.size()>0) customerServiceImpl.updatePendingReleaseLock(newList);
-						  newList.clear();
-						  Thread.sleep(2000);
-					  }  
-				  }
-			}
-			  if (lockBusinessList!=null&&lockBusinessList.size()>0) {
-				  for(int i=0;i<lockBusinessList.size();i++){
-					  newList.add(lockBusinessList.get(i));
-					  if(pointsDataLimit == newList.size()||i == lockBusinessList.size()-1){
-						  if(newList.size()>0) customerServiceImpl.updatePendingReleaseLock(newList);
-						  newList.clear();
-						  Thread.sleep(2000);
-					  }  
-				  }
-			}
-			List<LockingReleaseBo> lockList=customerServiceImpl.selectPendinglockUserList();
-			if (lockList.size()>0)customerServiceImpl.updateReleaseLock(releaseTime);
-			/*if(lockUserList.size()>0) customerServiceImpl.updateReleaseLock(lockUserList,releaseTime);
-			if(lockBusinessList.size()>0) customerServiceImpl.updateReleaseLock(lockBusinessList,releaseTime);
-			if(lockUserList.size()>0) userServiceImpl.updateReleaseLock(lockUserList);*/
-
-		} catch (Exception e) {
-			Notice n =new Notice(UUID.randomUUID().toString(),new Date(),0,"1",NoticeStatus.TASK_PATENT_ERROR.getCode(),"==============客户释放失败================");
-			 noticeMapper.insert(n);
-			EmailBo emailBo = new EmailBo( "释放客户失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统", "释放客户失败");
-			try {
-				SendEmailUtil.getInstance().send(emailBo);
-			} catch (UnsupportedEncodingException | MessagingException e1) {
-				e1.printStackTrace();
-			}
-			LoggerUtils.error(getClass(), "====================客户释放失败=================");
-			LoggerUtils.error(getClass(), "客户释放失败", e);
-		}
-		LoggerUtils.debug(getClass(), "==============客户释放完成============");
-	}
-	
-}
+package com.goafanti.common.task;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import javax.annotation.Resource;
+import javax.mail.MessagingException;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import com.goafanti.common.bo.EmailBo;
+import com.goafanti.common.bo.userDaysBo;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.NoticeMapper;
+import com.goafanti.common.enums.NoticeStatus;
+import com.goafanti.common.model.Notice;
+import com.goafanti.common.model.User;
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.common.utils.SendEmailUtil;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.customer.bo.LockingReleaseBo;
+import com.goafanti.customer.service.CustomerService;
+import com.goafanti.user.service.UserService;
+
+@Component
+@Controller
+public class ReleaseUserTask {
+	@Resource
+	private CustomerService customerServiceImpl;
+	@Resource
+	private UserService userServiceImpl;
+	@Autowired
+	private NoticeMapper	noticeMapper;
+	
+	int pointsDataLimit=50;
+	
+	/**
+	 *   每天凌晨一点
+	 * @throws InterruptedException
+	 */
+//	@Scheduled(cron = "0 55 15  * * ?")
+	@Scheduled(cron = "0 0 1  * * ?")
+	public void startTask()  {
+		try {
+			pushUserDays();
+			Thread.sleep(2000);
+			updateUser();
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+		
+	}
+	
+	
+	private void pushUserDays() throws InterruptedException {
+		LoggerUtils.debug(getClass(), "==============客户提醒开始============");
+		List<User> userList = userServiceImpl.selectUserByRoleName("营销员","营销经理");
+		List<userDaysBo> count = new ArrayList<>();
+		List<userDaysBo> userTmpList = null;
+		for(User u : userList){
+			if(StringUtils.isNotBlank(u.getId())) {
+				userTmpList = customerServiceImpl.selectUserDays(u.getId());
+			}
+			if(!userTmpList.isEmpty())count.addAll(userTmpList);
+		}
+		List<Notice> ln=new ArrayList<>();
+		for (userDaysBo ub : count) {
+			ln.add(new Notice(UUID.randomUUID().toString(),new Date(),0,
+				ub.getAid(),NoticeStatus.CUSTOMER_PRIVATE_REMINDER.getCode(),"您的客户:"+ub.getName()+",剩余天数不足十五天,请及时跟进或者限时签单!"));
+		}
+		List<Notice> newList=new ArrayList<>();
+		 if (ln!=null&&ln.size()>0) {
+			  for(int i=0;i<ln.size();i++){
+				  newList.add(ln.get(i));
+				  if(pointsDataLimit == newList.size()||i == ln.size()-1){
+					  if(newList.size()>0) noticeMapper.insertBatch(newList);
+					  newList.clear();
+					  Thread.sleep(2000);
+				  }  
+			  }
+		}
+		 LoggerUtils.debug(getClass(), "==============客户提醒结束============");
+	}
+
+
+	/**
+	 *将客户和业务转为待释放
+	 */
+	 
+	@RequestMapping(value = "/open/updateUser", method = RequestMethod.GET)
+	public void updateUser(){
+		LoggerUtils.debug(getClass(), "==============客户释放开始============");
+		Date releaseTime = new Date();
+		try {
+			List<User> userList = userServiceImpl.selectUserByRoleName("营销员","营销经理");
+			List<LockingReleaseBo> lockUserList = new ArrayList<LockingReleaseBo>();
+			List<LockingReleaseBo> lockBusinessList = new ArrayList<LockingReleaseBo>();
+			List<LockingReleaseBo> userTmpList = null;
+			List<LockingReleaseBo> businessTmpList = null;
+			if (userList!=null&&!userList.isEmpty()) {
+				for(User u : userList){
+					if(StringUtils.isNotBlank(u.getId())) {
+						userTmpList = customerServiceImpl.selectWaitReleaseCustomer(u.getId());
+//						userTmpList = customerServiceImpl.selectWaitReleaseCustomer("1");
+							if(userTmpList!=null&&!userTmpList.isEmpty())lockUserList.addAll(userTmpList);
+							businessTmpList = customerServiceImpl.selectWaitReleaseBusiness(u.getId());
+//						businessTmpList = customerServiceImpl.selectWaitReleaseBusiness("1");
+							if(businessTmpList!=null&&!businessTmpList.isEmpty())lockBusinessList.addAll(businessTmpList);
+						}
+				}
+				
+			}
+		List<LockingReleaseBo> newList=new ArrayList<LockingReleaseBo>();
+			  if (lockUserList!=null&&lockUserList.size()>0) {
+				  for(int i=0;i<lockUserList.size();i++){
+					  newList.add(lockUserList.get(i));
+					  if(pointsDataLimit == newList.size()||i == lockUserList.size()-1){
+						  if(newList.size()>0) customerServiceImpl.updatePendingReleaseLock(newList);
+						  newList.clear();
+						  Thread.sleep(2000);
+					  }  
+				  }
+			}
+			  if (lockBusinessList!=null&&lockBusinessList.size()>0) {
+				  for(int i=0;i<lockBusinessList.size();i++){
+					  newList.add(lockBusinessList.get(i));
+					  if(pointsDataLimit == newList.size()||i == lockBusinessList.size()-1){
+						  if(newList.size()>0) customerServiceImpl.updatePendingReleaseLock(newList);
+						  newList.clear();
+						  Thread.sleep(2000);
+					  }  
+				  }
+			}
+			List<LockingReleaseBo> lockList=customerServiceImpl.selectPendinglockUserList();
+			if (lockList.size()>0)customerServiceImpl.updateReleaseLock(releaseTime);
+		
+
+		} catch (Exception e) {
+			Notice n =new Notice(UUID.randomUUID().toString(),new Date(),0,"1",NoticeStatus.TASK_PATENT_ERROR.getCode(),"==============客户释放失败================");
+			 noticeMapper.insert(n);
+			EmailBo emailBo = new EmailBo( "释放客户失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台",  "系统", "释放客户失败");
+			try {
+				SendEmailUtil.getInstance().send(emailBo);
+			} catch (UnsupportedEncodingException | MessagingException e1) {
+				e1.printStackTrace();
+			}
+			LoggerUtils.error(getClass(), "====================客户释放失败=================");
+			LoggerUtils.error(getClass(), "客户释放失败", e);
+		}
+		LoggerUtils.debug(getClass(), "==============客户释放完成============");
+	}
+	
+}

+ 160 - 161
src/main/java/com/goafanti/common/utils/SendEmailUtil.java

@@ -1,161 +1,160 @@
-package com.goafanti.common.utils;
-
-import java.io.UnsupportedEncodingException;
-import java.security.GeneralSecurityException;
-import java.util.Date;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.mail.Authenticator;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeUtility;
-
-
-import com.goafanti.common.bo.EmailBo;
-import com.goafanti.common.constant.AFTConstants;
-import com.sun.mail.util.MailSSLSocketFactory;
-
-public class SendEmailUtil {
-	private static Session session;
-	private static volatile SendEmailUtil singleton;
-	private SendEmailUtil() {}
-	public static SendEmailUtil getInstance() {
-      if (singleton == null) {
-          synchronized (SendEmailUtil.class) {
-              if (singleton == null) {
-                  singleton = new SendEmailUtil();
-                  session = getSession();
-              }
-          }
-      }
-      return singleton;
-  }
-	public static final String HOST = "smtp.163.com";
-	public static final String PORT = "465";
-	public static final String AUTH_USER_NICKNAME = "湖南科德信息咨询有限公司";
-	public static final String FROM = "13875952633@163.com";// 发件人的email
-	public static final String PWD = "kede2018";// 发件人密码
-	public static final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
-	
-	
-
-	private static Session getSession() {
-		Properties props = new Properties();
-
-		//开启安全协议
-        MailSSLSocketFactory sf = null;
-		try {
-			sf = new MailSSLSocketFactory();
-			sf.setTrustAllHosts(true);
-		} catch (GeneralSecurityException e) {
-			e.printStackTrace();
-		}
-        props.setProperty("mail.smtp.ssl.enable", "true");
-        props.put("mail.smtp.ssl.socketFactory", sf);
-        props.setProperty("mail.smtp.socketFactory.port", PORT);
-        props.setProperty("mail.smtp.socketFactory.fallback", "false");// 注意是字符串的true,不是boolean类型的true
-		// 这一套是465端口
-		props.setProperty("mail.smtp.host", HOST);// 设置服务器地址
-		props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);// 设置协议
-		props.setProperty("mail.smtp.port", PORT);// 设置端口
-		props.put("mail.smtp.auth", "true");// 注意是字符串的true,不是boolean类型的true
-
-		Authenticator authenticator = new Authenticator() {
-			@Override
-			protected PasswordAuthentication getPasswordAuthentication() {
-				return new PasswordAuthentication(FROM, PWD);
-			}
-
-		};
-		Session session = Session.getDefaultInstance(props, authenticator);
-		System.out.println("session hash code" + session.hashCode());
-		return session;
-	}
-
-	/**
-	 * 如果要给多个人发,请EmailBo 的 address , addressee用逗号隔开 注意要一一对应且个数相等
-	 * @param emailBo
-	 * @throws MessagingException
-	 * @throws UnsupportedEncodingException
-	 */
-	public void send(EmailBo emailBo)
-			throws MessagingException, UnsupportedEncodingException {
-		// Session session = getSession();
-		// Instantiate a message
-		Message msg = new MimeMessage(session);
-		// Set message attributes
-		msg.setFrom(new InternetAddress(MimeUtility.encodeText(AUTH_USER_NICKNAME) +"<" +  FROM + ">"));
-//		msg.setFrom(new InternetAddress(FROM));
-		String[] adds =  emailBo.getAddress().split(",");
-		String[] ees =  emailBo.getAddressee().split(",");
-		for (int i = 0; i < adds.length; i++) {
-			InternetAddress internetAddress = new InternetAddress(adds[i]);
-			msg.setRecipient(Message.RecipientType.TO, internetAddress);
-			msg.setSubject(emailBo.getSubject());
-			msg.setSentDate(new Date());
-			msg.setContent(emailBo.format(ees[i]), "text/html;charset=utf-8");
-			// Send the message
-			Transport.send(msg);
-		}
-	}
-	
-	/**
-	 * 如果要给多个人发,请EmailBo 的 address , addressee用逗号隔开 注意要一一对应且个数相等
-	 * @param emailBo
-	 * @throws MessagingException
-	 * @throws UnsupportedEncodingException
-	 */
-	public void patentSend(EmailBo emailBo)
-			throws MessagingException, UnsupportedEncodingException {
-		// Session session = getSession();
-		// Instantiate a message
-		Message msg = new MimeMessage(session);
-
-		// Set message attributes
-		msg.setFrom(new InternetAddress(MimeUtility.encodeText(AUTH_USER_NICKNAME) +"<" +  FROM + ">"));
-		emailBo.SetEnd("");
-//		msg.setFrom(new InternetAddress(FROM));
-		String[] adds =  emailBo.getAddress().split(",");
-//		String[] ees =  emailBo.getAddressee().split(",");
-		for (int i = 0; i < adds.length; i++) {
-			InternetAddress internetAddress = new InternetAddress(adds[i]);
-			msg.setRecipient(Message.RecipientType.TO, internetAddress);
-			msg.setSubject(emailBo.getSubject());
-			msg.setSentDate(new Date());
-			msg.setContent(emailBo.getContent(), "text/html;charset=utf-8");
-			// Send the message
-			Transport.send(msg);
-		}
-	}
-	
-	public static boolean isEmail(String email){
-    	//邮箱正则表达式
-        String pattern = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
-        Pattern p = Pattern.compile(pattern);
-        Matcher m = p.matcher(email);
-        return m.matches();
-    }
-	
-	
-	
-	
-	
-	
-	public static void main(String[] args) {
-		  EmailBo emailBo = new EmailBo( "专利提醒失败",  "312518615@qq.com",  "超管", "平台",  "系统", "专利提醒失败");
-				try {
-					SendEmailUtil.getInstance().send(emailBo);
-				} catch (UnsupportedEncodingException | MessagingException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-	}
-	
-}
+package com.goafanti.common.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.security.GeneralSecurityException;
+import java.util.Date;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeUtility;
+
+
+import com.goafanti.common.bo.EmailBo;
+import com.sun.mail.util.MailSSLSocketFactory;
+
+public class SendEmailUtil {
+	private static Session session;
+	private static volatile SendEmailUtil singleton;
+	private SendEmailUtil() {}
+	public static SendEmailUtil getInstance() {
+      if (singleton == null) {
+          synchronized (SendEmailUtil.class) {
+              if (singleton == null) {
+                  singleton = new SendEmailUtil();
+                  session = getSession();
+              }
+          }
+      }
+      return singleton;
+  }
+	public static final String HOST = "smtp.163.com";
+	public static final String PORT = "465";
+	public static final String AUTH_USER_NICKNAME = "湖南科德信息咨询有限公司";
+	public static final String FROM = "13875952633@163.com";// 发件人的email
+	public static final String PWD = "kede2018";// 发件人密码
+	public static final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
+	
+	
+
+	private static Session getSession() {
+		Properties props = new Properties();
+
+		//开启安全协议
+        MailSSLSocketFactory sf = null;
+		try {
+			sf = new MailSSLSocketFactory();
+			sf.setTrustAllHosts(true);
+		} catch (GeneralSecurityException e) {
+			e.printStackTrace();
+		}
+        props.setProperty("mail.smtp.ssl.enable", "true");
+        props.put("mail.smtp.ssl.socketFactory", sf);
+        props.setProperty("mail.smtp.socketFactory.port", PORT);
+        props.setProperty("mail.smtp.socketFactory.fallback", "false");// 注意是字符串的true,不是boolean类型的true
+		// 这一套是465端口
+		props.setProperty("mail.smtp.host", HOST);// 设置服务器地址
+		props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);// 设置协议
+		props.setProperty("mail.smtp.port", PORT);// 设置端口
+		props.put("mail.smtp.auth", "true");// 注意是字符串的true,不是boolean类型的true
+
+		Authenticator authenticator = new Authenticator() {
+			@Override
+			protected PasswordAuthentication getPasswordAuthentication() {
+				return new PasswordAuthentication(FROM, PWD);
+			}
+
+		};
+		Session session = Session.getDefaultInstance(props, authenticator);
+		System.out.println("session hash code" + session.hashCode());
+		return session;
+	}
+
+	/**
+	 * 如果要给多个人发,请EmailBo 的 address , addressee用逗号隔开 注意要一一对应且个数相等
+	 * @param emailBo
+	 * @throws MessagingException
+	 * @throws UnsupportedEncodingException
+	 */
+	public void send(EmailBo emailBo)
+			throws MessagingException, UnsupportedEncodingException {
+		// Session session = getSession();
+		// Instantiate a message
+		Message msg = new MimeMessage(session);
+		// Set message attributes
+		msg.setFrom(new InternetAddress(MimeUtility.encodeText(AUTH_USER_NICKNAME) +"<" +  FROM + ">"));
+//		msg.setFrom(new InternetAddress(FROM));
+		String[] adds =  emailBo.getAddress().split(",");
+		String[] ees =  emailBo.getAddressee().split(",");
+		for (int i = 0; i < adds.length; i++) {
+			InternetAddress internetAddress = new InternetAddress(adds[i]);
+			msg.setRecipient(Message.RecipientType.TO, internetAddress);
+			msg.setSubject(emailBo.getSubject());
+			msg.setSentDate(new Date());
+			msg.setContent(emailBo.format(ees[i]), "text/html;charset=utf-8");
+			// Send the message
+			Transport.send(msg);
+		}
+	}
+	
+	/**
+	 * 如果要给多个人发,请EmailBo 的 address , addressee用逗号隔开 注意要一一对应且个数相等
+	 * @param emailBo
+	 * @throws MessagingException
+	 * @throws UnsupportedEncodingException
+	 */
+	public void patentSend(EmailBo emailBo)
+			throws MessagingException, UnsupportedEncodingException {
+		// Session session = getSession();
+		// Instantiate a message
+		Message msg = new MimeMessage(session);
+
+		// Set message attributes
+		msg.setFrom(new InternetAddress(MimeUtility.encodeText(AUTH_USER_NICKNAME) +"<" +  FROM + ">"));
+		emailBo.SetEnd("");
+//		msg.setFrom(new InternetAddress(FROM));
+		String[] adds =  emailBo.getAddress().split(",");
+//		String[] ees =  emailBo.getAddressee().split(",");
+		for (int i = 0; i < adds.length; i++) {
+			InternetAddress internetAddress = new InternetAddress(adds[i]);
+			msg.setRecipient(Message.RecipientType.TO, internetAddress);
+			msg.setSubject(emailBo.getSubject());
+			msg.setSentDate(new Date());
+			msg.setContent(emailBo.getContent(), "text/html;charset=utf-8");
+			// Send the message
+			Transport.send(msg);
+		}
+	}
+	
+	public static boolean isEmail(String email){
+    	//邮箱正则表达式
+        String pattern = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
+        Pattern p = Pattern.compile(pattern);
+        Matcher m = p.matcher(email);
+        return m.matches();
+    }
+	
+	
+	
+	
+	
+	
+	public static void main(String[] args) {
+		  EmailBo emailBo = new EmailBo( "专利提醒失败",  "312518615@qq.com",  "超管", "平台",  "系统", "专利提醒失败");
+				try {
+					SendEmailUtil.getInstance().send(emailBo);
+				} catch (UnsupportedEncodingException | MessagingException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+	}
+	
+}

Diferenças do arquivo suprimidas por serem muito extensas
+ 519 - 517
src/main/java/com/goafanti/customer/service/CustomerService.java


Diferenças do arquivo suprimidas por serem muito extensas
+ 1609 - 1598
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java


+ 39 - 40
src/main/java/com/goafanti/order/bo/TChangeTaskOut.java

@@ -1,40 +1,39 @@
-package com.goafanti.order.bo;
-
-import java.util.List;
-
-import org.apache.poi.ss.formula.functions.T;
-
-import com.goafanti.common.model.TChangeTask;
-
-public class TChangeTaskOut extends TChangeTask{
-	private String cname;
-	private String receiverName;
-	private Integer cSort;
-	private List<?> list;
-	public Integer getcSort() {
-		return cSort;
-	}
-	public void setcSort(Integer cSort) {
-		this.cSort = cSort;
-	}
-	public String getCname() {
-		return cname;
-	}
-	public void setCname(String cname) {
-		this.cname = cname;
-	}
-	public List<?> getList() {
-		return list;
-	}
-	public void setList(List<?> list2) {
-		this.list = list2;
-	}
-	public String getReceiverName() {
-		return receiverName;
-	}
-	public void setReceiverName(String receiverName) {
-		this.receiverName = receiverName;
-	}
-	
-	
-}
+package com.goafanti.order.bo;
+
+import java.util.List;
+
+
+import com.goafanti.common.model.TChangeTask;
+
+public class TChangeTaskOut extends TChangeTask{
+	private String cname;
+	private String receiverName;
+	private Integer cSort;
+	private List<?> list;
+	public Integer getcSort() {
+		return cSort;
+	}
+	public void setcSort(Integer cSort) {
+		this.cSort = cSort;
+	}
+	public String getCname() {
+		return cname;
+	}
+	public void setCname(String cname) {
+		this.cname = cname;
+	}
+	public List<?> getList() {
+		return list;
+	}
+	public void setList(List<?> list2) {
+		this.list = list2;
+	}
+	public String getReceiverName() {
+		return receiverName;
+	}
+	public void setReceiverName(String receiverName) {
+		this.receiverName = receiverName;
+	}
+	
+	
+}

+ 79 - 81
src/main/java/com/goafanti/order/service/impl/NewOrderDunServiceImpl.java

@@ -1,81 +1,79 @@
-package com.goafanti.order.service.impl;
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.ParseException;
-import java.util.List;
-
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.commons.beanutils.ConvertUtils;
-import org.apache.commons.beanutils.converters.DateConverter;
-import org.apache.ibatis.builder.BuilderException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.NewOrderDunMapper;
-import com.goafanti.common.utils.DateUtils;
-import com.goafanti.core.mybatis.BaseMybatisDao;
-import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.order.bo.InputNewOrderDunBo;
-import com.goafanti.order.bo.OutNewOrderDunBo;
-import com.goafanti.order.enums.OrderDunProjectType;
-import com.goafanti.order.service.NewOrderDunService;
-@Service
-public class NewOrderDunServiceImpl extends BaseMybatisDao<NewOrderDunMapper> implements NewOrderDunService {
-
-	@Autowired
-	private NewOrderDunMapper	newOrderDunMapper;
-	
-	
-	@Override
-	public int createDun(InputNewOrderDunBo ib) {
-		ib.setAid(TokenManager.getAdminId());
-		if(ib.getCustomizeTimes()!=null)ib.setCustomizeTime(DateUtils.StringToDate(ib.getCustomizeTimes(), AFTConstants.YYYYMMDD));
-		if (ib.getAppropriationRatio()!=null)ib.setMoney(null);
-		if (ib.getProjectType()==OrderDunProjectType.HY.getCode()&&ib.getDunType()==2&&ib.getEffectiveCount()>1) {
-			for (int i = 1; i <= ib.getEffectiveCount(); i++) {
-				int x=ib.getEffectiveCount();
-				ib.setEffectiveCount(i);
-				newOrderDunMapper.insertSelective(ib);
-				ib.setEffectiveCount(x);
-			}
-		}else 	newOrderDunMapper.insertSelective(ib);
-		return 0;
-	}
-	
-	
-	@Override
-	public int updateDun(InputNewOrderDunBo ib) {
-		if (ib.getAppropriationRatio()!=null)ib.setMoney(null);
-		if(ib.getCustomizeTimes()!=null)ib.setCustomizeTime(DateUtils.StringToDate(ib.getCustomizeTimes(), AFTConstants.YYYYMMDD));
-		return newOrderDunMapper.updateByPrimaryKeySelective(ib);
-	}
-	@Override
-	public int deleteDun(Integer id) {
-		return newOrderDunMapper.deleteByPrimaryKey(id);
-	}
-	@Override
-	public List<OutNewOrderDunBo> selectListNewOrderDun(String orderNo) {
-		return newOrderDunMapper.selectListNewOrderDun(orderNo,null,null);
-	}
-	@Override
-	public OutNewOrderDunBo selectDun(Integer id) {
-		OutNewOrderDunBo ob=new OutNewOrderDunBo();
-		try {
-			ConvertUtils.register(new DateConverter(null), java.util.Date.class);
-			BeanUtils.copyProperties(ob, newOrderDunMapper.selectByPrimaryKey(id));
-		} catch (IllegalAccessException | InvocationTargetException e) {
-			e.printStackTrace();
-		}
-		return ob;
-	}
-	
-	
-	@Override
-	public List<OutNewOrderDunBo> selectAllOrderDun() {
-		return newOrderDunMapper.selectAllOrderDun();
-	}
-	
-	
-
-}
+package com.goafanti.order.service.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.converters.DateConverter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.NewOrderDunMapper;
+import com.goafanti.common.utils.DateUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.order.bo.InputNewOrderDunBo;
+import com.goafanti.order.bo.OutNewOrderDunBo;
+import com.goafanti.order.enums.OrderDunProjectType;
+import com.goafanti.order.service.NewOrderDunService;
+@Service
+public class NewOrderDunServiceImpl extends BaseMybatisDao<NewOrderDunMapper> implements NewOrderDunService {
+
+	@Autowired
+	private NewOrderDunMapper	newOrderDunMapper;
+	
+	
+	@Override
+	public int createDun(InputNewOrderDunBo ib) {
+		ib.setAid(TokenManager.getAdminId());
+		if(ib.getCustomizeTimes()!=null)ib.setCustomizeTime(DateUtils.StringToDate(ib.getCustomizeTimes(), AFTConstants.YYYYMMDD));
+		if (ib.getAppropriationRatio()!=null)ib.setMoney(null);
+		if (ib.getProjectType()==OrderDunProjectType.HY.getCode()&&ib.getDunType()==2&&ib.getEffectiveCount()>1) {
+			for (int i = 1; i <= ib.getEffectiveCount(); i++) {
+				int x=ib.getEffectiveCount();
+				ib.setEffectiveCount(i);
+				newOrderDunMapper.insertSelective(ib);
+				ib.setEffectiveCount(x);
+			}
+		}else 	newOrderDunMapper.insertSelective(ib);
+		return 0;
+	}
+	
+	
+	@Override
+	public int updateDun(InputNewOrderDunBo ib) {
+		if (ib.getAppropriationRatio()!=null)ib.setMoney(null);
+		if(ib.getCustomizeTimes()!=null)ib.setCustomizeTime(DateUtils.StringToDate(ib.getCustomizeTimes(), AFTConstants.YYYYMMDD));
+		return newOrderDunMapper.updateByPrimaryKeySelective(ib);
+	}
+	@Override
+	public int deleteDun(Integer id) {
+		return newOrderDunMapper.deleteByPrimaryKey(id);
+	}
+	@Override
+	public List<OutNewOrderDunBo> selectListNewOrderDun(String orderNo) {
+		return newOrderDunMapper.selectListNewOrderDun(orderNo,null,null);
+	}
+	@Override
+	public OutNewOrderDunBo selectDun(Integer id) {
+		OutNewOrderDunBo ob=new OutNewOrderDunBo();
+		try {
+			ConvertUtils.register(new DateConverter(null), java.util.Date.class);
+			BeanUtils.copyProperties(ob, newOrderDunMapper.selectByPrimaryKey(id));
+		} catch (IllegalAccessException | InvocationTargetException e) {
+			e.printStackTrace();
+		}
+		return ob;
+	}
+	
+	
+	@Override
+	public List<OutNewOrderDunBo> selectAllOrderDun() {
+		return newOrderDunMapper.selectAllOrderDun();
+	}
+	
+	
+
+}

+ 0 - 1
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -121,7 +121,6 @@ import com.goafanti.order.service.OrderService;
 import com.goafanti.organization.bo.OrganizationListOut;
 import com.goafanti.organization.bo.OutPaymentNode;
 import com.goafanti.organization.bo.OutThirdPartyCompany;
-import com.goafanti.report.bo.DepartmentSalesReportBO;
 
 @Service
 @EnableAsync

+ 26 - 22
src/main/java/com/goafanti/organization/bo/outOrderPayment.java

@@ -5,10 +5,19 @@ import java.math.BigDecimal;
 import com.goafanti.common.model.TOrderPayment;
 
 public class outOrderPayment extends TOrderPayment{
-	 private Integer nodeQuantity;
-	 private BigDecimal nodePartyAmount;
-	 private BigDecimal nodeTotalAmount;
-	 private BigDecimal nodeUnitPrice;
+	/**
+	 * 原数量
+	 */
+	 private Integer initialQuantity;
+	 
+	 /**
+	 * 原总价
+	 */
+	 private BigDecimal initialTotalAmount;
+	 /**
+	 * 原单价
+	 */
+	 private BigDecimal initialUnitPrice;
 	 private String createTimes;
 	 
 	 private String financeName;
@@ -25,31 +34,26 @@ public class outOrderPayment extends TOrderPayment{
 	public void setCreateTimes(String createTimes) {
 		this.createTimes = createTimes;
 	}
-	public Integer getNodeQuantity() {
-		return nodeQuantity;
-	}
-	public void setNodeQuantity(Integer nodeQuantity) {
-		this.nodeQuantity = nodeQuantity;
+	public Integer getInitialQuantity() {
+		return initialQuantity;
 	}
-	public BigDecimal getNodePartyAmount() {
-		return nodePartyAmount;
+	public void setInitialQuantity(Integer initialQuantity) {
+		this.initialQuantity = initialQuantity;
 	}
-	public void setNodePartyAmount(BigDecimal nodePartyAmount) {
-		this.nodePartyAmount = nodePartyAmount;
+	public BigDecimal getInitialTotalAmount() {
+		return initialTotalAmount;
 	}
-	public BigDecimal getNodeTotalAmount() {
-		return nodeTotalAmount;
+	public void setInitialTotalAmount(BigDecimal initialTotalAmount) {
+		this.initialTotalAmount = initialTotalAmount;
 	}
-	public void setNodeTotalAmount(BigDecimal nodeTotalAmount) {
-		this.nodeTotalAmount = nodeTotalAmount;
+	public BigDecimal getInitialUnitPrice() {
+		return initialUnitPrice;
 	}
-	public BigDecimal getNodeUnitPrice() {
-		return nodeUnitPrice;
-	}
-	public void setNodeUnitPrice(BigDecimal nodeUnitPrice) {
-		this.nodeUnitPrice = nodeUnitPrice;
+	public void setInitialUnitPrice(BigDecimal initialUnitPrice) {
+		this.initialUnitPrice = initialUnitPrice;
 	}
 	
+	
 	/*public String getAuditInformation() {
 		if (getStatus()==null) return "";
 		else if (getStatus()==0) return "待"+financeName+"审核";

+ 34 - 3
src/main/java/com/goafanti/organization/service/impl/ThirdPartyCompanyServiceImpl.java

@@ -27,6 +27,7 @@ import com.goafanti.common.dao.PatentPriceMapper;
 import com.goafanti.common.dao.PaymentLogMapper;
 import com.goafanti.common.dao.PaymentNodeMapper;
 import com.goafanti.common.dao.SoftWritingPriceMapper;
+import com.goafanti.common.dao.TOrderOutsourceMapper;
 import com.goafanti.common.dao.TOrderPaymentMapper;
 import com.goafanti.common.dao.TOrderTaskMapper;
 import com.goafanti.common.dao.TTaskMidMapper;
@@ -39,13 +40,16 @@ import com.goafanti.common.model.PatentPrice;
 import com.goafanti.common.model.PaymentLog;
 import com.goafanti.common.model.PaymentNode;
 import com.goafanti.common.model.SoftWritingPrice;
+import com.goafanti.common.model.TOrderOutsource;
 import com.goafanti.common.model.TOrderPayment;
+import com.goafanti.common.model.TOrderTask;
 import com.goafanti.common.model.ThirdPartyCompany;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.SendEmailUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.order.bo.OrderOutsourceDtails;
 import com.goafanti.order.bo.TOrderTaskDetailBo;
 import com.goafanti.order.enums.NewOrderDunType;
 import com.goafanti.organization.bo.InputNodeList;
@@ -91,6 +95,8 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 	private TTaskMidMapper	tTaskMidMapper;
 	@Autowired
 	private PatentPriceMapper	patentPriceMapper;
+	@Autowired
+	private TOrderOutsourceMapper	tOrderOutsourceMapper;
 	
 	
 
@@ -236,9 +242,34 @@ public class ThirdPartyCompanyServiceImpl extends  BaseMybatisDao<ThirdPartyComp
 
 	@Override
 	public outOrderPayment OrderPaymentDetails(Integer id) {
-		TOrderPayment tt=tOrderPaymentMapper.selectByPrimaryKey(id);
-		int type=tt.getChooseType();
-		return tOrderPaymentMapper.selectByidGetDetails(id,type);
+		TOrderPayment tp=tOrderPaymentMapper.selectByPrimaryKey(id);
+		Integer type=tp.getChooseType();
+		outOrderPayment op=tOrderPaymentMapper.selectByidGetDetails(id);
+		if (type==0) {//支付种类 0第三方 1催款 2官费
+			ThirdPartyCompany tpc=thirdPartyCompanyMapper.selectByPrimaryKey(tp.getTpcId());
+			op.setInitialQuantity(tpc.getQuantity());
+			op.setInitialTotalAmount(tpc.getTotalAmount());
+			op.setInitialUnitPrice(tpc.getUnitPrice());
+			 
+		}else if (type==1) {
+			PaymentNode pn=paymentNodeMapper.selectByPrimaryKey(tp.getNodeId());
+			op.setInitialQuantity(pn.getQuantity());
+			op.setInitialTotalAmount(pn.getTotalAmount());
+			op.setInitialUnitPrice(pn.getUnitPrice());
+		}else if (type==2) {
+			ThirdPartyCompany tpc=thirdPartyCompanyMapper.selectByPrimaryKey(tp.getTpcId());
+			op.setInitialQuantity(tpc.getQuantity());
+			TOrderTask tk=tOrderTaskMapper.selectByPrimaryKey(tp.getTid());
+			OrderOutsourceDtails out=tOrderOutsourceMapper.selectByOrderNo(null, tp.getTid().toString());
+			OfficialFeePrice of=officialFeePriceMapper.selectBytype(out.getPatentNameType());
+			 if (tk.getCostReduction()==0) {
+				op.setInitialUnitPrice(of.getAmount());
+			}else {
+				op.setInitialUnitPrice(of.getProportion85());
+			}
+			 op.setInitialTotalAmount(op.getInitialUnitPrice().multiply(new BigDecimal(op.getInitialQuantity())));
+		}
+		return op;
 	}
 
 

+ 2 - 0
src/main/resources/props/config_local.properties

@@ -58,6 +58,8 @@ template.cacheable=false
 
 user.receive.max=10
 user.private.max=1000
+#客户释放提醒
+user_remind_days=15
 
 portal.host=//sf.jishutao.com/portal/2.0.6
 avatar.upload.host=//sb.jishutao.com/upload

+ 2 - 0
src/main/resources/props/config_test.properties

@@ -56,6 +56,8 @@ template.cacheable=false
 
 user.receive.max=10
 user.private.max=1000
+#客户释放提醒
+user_remind_days=15
 
 static.host=//static.jishutao.com/1.1.48
 portal.host=//static.jishutao.com/portal/2.0.6