|
|
@@ -1495,7 +1495,7 @@ func (this *OilSupplierCertController) SendingSMSSupplierFile() {
|
|
|
paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
month, _ := strconv.Atoi(paramSvc.GetBaseparameterMessage("GFGL", "paramset", "QualificationMonth"))
|
|
|
var expireFile []supplier.ExpireFile
|
|
|
- where := " b.EffectDate LIKE '%" + time.Now().AddDate(0, month, 0).Format("2006-01-02") + "%'"
|
|
|
+ where := " DATE_FORMAT(b.EffectDate, '%Y-%m-%d') = '" + time.Now().AddDate(0, month, 0).Format("2006-01-02") + "'"
|
|
|
err := svcsupp.GetExpireFile(OilSupplierName, OilSupplierFileName, &expireFile, where)
|
|
|
|
|
|
if err == nil {
|
|
|
@@ -1530,32 +1530,59 @@ func (this *OilSupplierCertController) ChangeSupplierStatus() {
|
|
|
|
|
|
svcsupp := supplier.GetOilSupplierService(utils.DBE)
|
|
|
var fileData []supplier.ExpireFileList
|
|
|
- where := " b.EffectDate <= '" + time.Now().AddDate(0, 0, -1).Format("2006-01-02") + "'"
|
|
|
+ where := " b.EffectDate <= '" + time.Now().Format("2006-01-02") + "'"
|
|
|
svcsupp.GetExpireFileList(OilSupplierName, OilSupplierFileName, &fileData, where)
|
|
|
|
|
|
for _, item := range fileData {
|
|
|
- var sert suppliercert.OilSupplierCert
|
|
|
cols := []string{
|
|
|
"InFlag",
|
|
|
"Remark",
|
|
|
}
|
|
|
- sert.InFlag = "2"
|
|
|
- sert.Remark = "资质过期"
|
|
|
-
|
|
|
- where := "SupplierId=" + strconv.Itoa(item.Id) + " AND InFlag = '1'"
|
|
|
+ where := "SupplierId=" + strconv.Itoa(item.Id)
|
|
|
if item.SupplierTypeCode != "000" {
|
|
|
where = where + " and SupplierTypeCode='" + item.SupplierTypeCode + "'"
|
|
|
}
|
|
|
- svcsupp.UpdateEntityBywheretbl(OilSupplierCertName, &sert, cols, where)
|
|
|
+ var tmpCertList []suppliercert.OilSupplierCert
|
|
|
+ svcsupp.GetEntitysByWhere(OilSupplierCertName, where, &tmpCertList)
|
|
|
+ for _, tmpCertItem := range tmpCertList {
|
|
|
+ if tmpCertItem.InFlag == "1" {
|
|
|
+ tmpCertItem.InFlag = "2"
|
|
|
+ if tmpCertItem.ApplyTime.Before(time.Now()) {
|
|
|
+ // 年审到期
|
|
|
+ tmpCertItem.Remark = strings.Trim("年审过期,资质过期," + tmpCertItem.Remark, ",")
|
|
|
+ } else {
|
|
|
+ tmpCertItem.Remark = strings.Trim("资质过期," + tmpCertItem.Remark, ",")
|
|
|
+ }
|
|
|
+ svcsupp.UpdateEntityByIdCols(tmpCertItem.Id, &tmpCertItem, cols)
|
|
|
+
|
|
|
+ } else if tmpCertItem.InFlag == "2" && !strings.Contains(tmpCertItem.Remark, "资质过期") {
|
|
|
+ tmpCertItem.InFlag = "2"
|
|
|
+ tmpCertItem.Remark = strings.Trim("资质过期," + tmpCertItem.Remark, ",")
|
|
|
+ svcsupp.UpdateEntityByIdCols(tmpCertItem.Id, &tmpCertItem, cols)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 查询年审过期 和 资质都过期的
|
|
|
- sqlYearCertLost := "update OilSupplierCert set Remark=CONCAT_WS(',', '年审过期', Remark) where Remark in ('资质过期', '不良记录', '资质过期,不良记录') AND InFlag = '2' AND ApplyTime <= '" + time.Now().AddDate(0, 0, -1).Format("2006-01-02") + "'"
|
|
|
+ sqlYearCertLost := "update OilSupplierCert set Remark=CONCAT_WS(',', '年审过期', Remark) where locate('年审过期', Remark) = 0 and locate('年检过期', Remark) = 0 AND InFlag = '2' AND ApplyTime <= '" + time.Now().Format("2006-01-02") + "'"
|
|
|
utils.DBE.Query(sqlYearCertLost)
|
|
|
|
|
|
// 查询年审过期的
|
|
|
- sqlYearLost := "update OilSupplierCert set Remark='年审过期', InFlag = '2' where InFlag = '1' AND ApplyTime <= '" + time.Now().AddDate(0, 0, -1).Format("2006-01-02") + "'"
|
|
|
+ sqlYearLost := "update OilSupplierCert set Remark=CONCAT_WS(',', '年审过期', Remark), InFlag = '2' where InFlag = '1' AND ApplyTime <= '" + time.Now().Format("2006-01-02") + "'"
|
|
|
utils.DBE.Query(sqlYearLost)
|
|
|
+
|
|
|
+ // 将过期时间的更正过来,SQL备份
|
|
|
+ /*
|
|
|
+ -- SELECT id, cert.SupplierId, Inflag, Remark FROM OilSupplierCert cert
|
|
|
+ UPDATE OilSupplierCert cert SET cert.InFlag='1', cert.Remark=''
|
|
|
+ WHERE cert.InFlag='2' AND cert.Remark = '资质过期'
|
|
|
+ AND NOT EXISTS (
|
|
|
+ SELECT Id, `NeedFileType`, a.EffectDate FROM `OilSupplierFile` a
|
|
|
+ WHERE a.EffectDate <= NOW()
|
|
|
+ AND a.SupplierTypeCode IN ('000', cert.SupplierTypeCode)
|
|
|
+ AND a.SupplierId = cert.SupplierId
|
|
|
+ ) */
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// @Title 更新Inflag状态
|